优化访问控制,将“认证”两字改为“鉴权”

This commit is contained in:
GoEdgeLab
2022-08-30 11:22:54 +08:00
parent ba0ae51592
commit 977c89f9e1
22 changed files with 756 additions and 77 deletions

View File

@@ -2485,13 +2485,13 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
<button class="ui button tiny" type="button" @click.prevent="add">+</button>
</div>
<p class="comment">系统总是会先执行记录日志、标签等不会修改请求的动作,再执行阻止、验证码等可能改变请求的动作。</p>
</div>`}),Vue.component("http-auth-config-box",{props:["v-auth-config","v-is-location"],data:function(){let e=this.vAuthConfig;return null==(e=null==e?{isPrior:!1,isOn:!1}:e).policyRefs&&(e.policyRefs=[]),{authConfig:e}},methods:{isOn:function(){return(!this.vIsLocation||this.authConfig.isPrior)&&this.authConfig.isOn},add:function(){let t=this;teaweb.popup("/servers/server/settings/access/createPopup",{callback:function(e){t.authConfig.policyRefs.push(e.data.policyRef)},height:"28em"})},update:function(e,t){teaweb.popup("/servers/server/settings/access/updatePopup?policyId="+t,{callback:function(e){teaweb.success("保存成功",function(){teaweb.reload()})},height:"28em"})},remove:function(e){this.authConfig.policyRefs.$remove(e)},methodName:function(e){switch(e){case"basicAuth":return"BasicAuth";case"subRequest":return"子请求"}return""}},template:`<div>
</div>`}),Vue.component("http-auth-config-box",{props:["v-auth-config","v-is-location"],data:function(){let e=this.vAuthConfig;return null==(e=null==e?{isPrior:!1,isOn:!1}:e).policyRefs&&(e.policyRefs=[]),{authConfig:e}},methods:{isOn:function(){return(!this.vIsLocation||this.authConfig.isPrior)&&this.authConfig.isOn},add:function(){let t=this;teaweb.popup("/servers/server/settings/access/createPopup",{callback:function(e){t.authConfig.policyRefs.push(e.data.policyRef),t.change()},height:"28em"})},update:function(e,t){teaweb.popup("/servers/server/settings/access/updatePopup?policyId="+t,{callback:function(e){teaweb.success("保存成功",function(){teaweb.reload()})},height:"28em"})},remove:function(e){this.authConfig.policyRefs.$remove(e),this.change()},methodName:function(e){switch(e){case"basicAuth":return"BasicAuth";case"subRequest":return"子请求";case"typeA":return"URL鉴权A";case"typeB":return"URL鉴权B";case"typeC":return"URL鉴权C";case"typeD":return"URL鉴权D"}return""},change:function(){let e=this;setTimeout(function(){e.$emit("change",this.authConfig)},100)}},template:`<div>
<input type="hidden" name="authJSON" :value="JSON.stringify(authConfig)"/>
<table class="ui table selectable definition">
<prior-checkbox :v-config="authConfig" v-if="vIsLocation"></prior-checkbox>
<tbody v-show="!vIsLocation || authConfig.isPrior">
<tr>
<td class="title">启用认证</td>
<td class="title">启用鉴权</td>
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="authConfig.isOn"/>
@@ -2502,14 +2502,14 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
</tbody>
</table>
<div class="margin"></div>
<!-- 认证方式 -->
<!-- 鉴权方式 -->
<div v-show="isOn()">
<h4>认证方式</h4>
<h4>鉴权方式</h4>
<table class="ui table selectable celled" v-show="authConfig.policyRefs.length > 0">
<thead>
<tr>
<th class="three wide">名称</th>
<th class="three wide">认证方法</th>
<th class="three wide">鉴权方法</th>
<th>参数</th>
<th class="two wide">状态</th>
<th class="two op">操作</th>
@@ -2527,6 +2527,15 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
<span v-if="ref.authPolicy.params.method.length > 0" class="grey">[{{ref.authPolicy.params.method}}]</span>
{{ref.authPolicy.params.url}}
</span>
<span v-if="ref.authPolicy.type == 'typeA'">{{ref.authPolicy.params.signParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeB'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeC'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeD'">{{ref.authPolicy.params.signParamName}}/{{ref.authPolicy.params.timestampParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
<div v-if="(ref.authPolicy.params.exts != null && ref.authPolicy.params.exts.length > 0) || (ref.authPolicy.params.domains != null && ref.authPolicy.params.domains.length > 0)">
<grey-label v-if="ref.authPolicy.params.exts != null" v-for="ext in ref.authPolicy.params.exts">扩展名:{{ext}}</grey-label>
<grey-label v-if="ref.authPolicy.params.domains != null" v-for="domain in ref.authPolicy.params.domains">域名:{{domain}}</grey-label>
</div>
</td>
<td>
<label-on :v-is-on="ref.authPolicy.isOn"></label-on>
@@ -2538,7 +2547,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
</tr>
</tbody>
</table>
<button class="ui button small" type="button" @click.prevent="add">+添加认证方式</button>
<button class="ui button small" type="button" @click.prevent="add">+添加鉴权方式</button>
</div>
<div class="margin"></div>
</div>`}),Vue.component("user-selector",{props:["v-user-id","data-url"],data:function(){let e=this.vUserId,t=(null==e&&(e=0),this.dataUrl);return null!=t&&0!=t.length||(t="/servers/users/options"),{users:[],userId:e,dataURL:t}},methods:{change:function(e){null!=e?this.$emit("change",e.id):this.$emit("change",0)}},template:`<div>

View File

@@ -7457,6 +7457,7 @@ Vue.component("http-auth-config-box", {
teaweb.popup("/servers/server/settings/access/createPopup", {
callback: function (resp) {
that.authConfig.policyRefs.push(resp.data.policyRef)
that.change()
},
height: "28em"
})
@@ -7474,6 +7475,7 @@ Vue.component("http-auth-config-box", {
},
remove: function (index) {
this.authConfig.policyRefs.$remove(index)
this.change()
},
methodName: function (methodType) {
switch (methodType) {
@@ -7481,8 +7483,23 @@ Vue.component("http-auth-config-box", {
return "BasicAuth"
case "subRequest":
return "子请求"
case "typeA":
return "URL鉴权A"
case "typeB":
return "URL鉴权B"
case "typeC":
return "URL鉴权C"
case "typeD":
return "URL鉴权D"
}
return ""
},
change: function () {
let that = this
setTimeout(function () {
// 延时通知,是为了让表单有机会变更数据
that.$emit("change", this.authConfig)
}, 100)
}
},
template: `<div>
@@ -7491,7 +7508,7 @@ Vue.component("http-auth-config-box", {
<prior-checkbox :v-config="authConfig" v-if="vIsLocation"></prior-checkbox>
<tbody v-show="!vIsLocation || authConfig.isPrior">
<tr>
<td class="title">启用认证</td>
<td class="title">启用鉴权</td>
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="authConfig.isOn"/>
@@ -7502,14 +7519,14 @@ Vue.component("http-auth-config-box", {
</tbody>
</table>
<div class="margin"></div>
<!-- 认证方式 -->
<!-- 鉴权方式 -->
<div v-show="isOn()">
<h4>认证方式</h4>
<h4>鉴权方式</h4>
<table class="ui table selectable celled" v-show="authConfig.policyRefs.length > 0">
<thead>
<tr>
<th class="three wide">名称</th>
<th class="three wide">认证方法</th>
<th class="three wide">鉴权方法</th>
<th>参数</th>
<th class="two wide">状态</th>
<th class="two op">操作</th>
@@ -7527,6 +7544,15 @@ Vue.component("http-auth-config-box", {
<span v-if="ref.authPolicy.params.method.length > 0" class="grey">[{{ref.authPolicy.params.method}}]</span>
{{ref.authPolicy.params.url}}
</span>
<span v-if="ref.authPolicy.type == 'typeA'">{{ref.authPolicy.params.signParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeB'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeC'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeD'">{{ref.authPolicy.params.signParamName}}/{{ref.authPolicy.params.timestampParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
<div v-if="(ref.authPolicy.params.exts != null && ref.authPolicy.params.exts.length > 0) || (ref.authPolicy.params.domains != null && ref.authPolicy.params.domains.length > 0)">
<grey-label v-if="ref.authPolicy.params.exts != null" v-for="ext in ref.authPolicy.params.exts">扩展名:{{ext}}</grey-label>
<grey-label v-if="ref.authPolicy.params.domains != null" v-for="domain in ref.authPolicy.params.domains">域名:{{domain}}</grey-label>
</div>
</td>
<td>
<label-on :v-is-on="ref.authPolicy.isOn"></label-on>
@@ -7538,7 +7564,7 @@ Vue.component("http-auth-config-box", {
</tr>
</tbody>
</table>
<button class="ui button small" type="button" @click.prevent="add">+添加认证方式</button>
<button class="ui button small" type="button" @click.prevent="add">+添加鉴权方式</button>
</div>
<div class="margin"></div>
</div>`

View File

@@ -25,6 +25,7 @@ Vue.component("http-auth-config-box", {
teaweb.popup("/servers/server/settings/access/createPopup", {
callback: function (resp) {
that.authConfig.policyRefs.push(resp.data.policyRef)
that.change()
},
height: "28em"
})
@@ -42,6 +43,7 @@ Vue.component("http-auth-config-box", {
},
remove: function (index) {
this.authConfig.policyRefs.$remove(index)
this.change()
},
methodName: function (methodType) {
switch (methodType) {
@@ -49,8 +51,23 @@ Vue.component("http-auth-config-box", {
return "BasicAuth"
case "subRequest":
return "子请求"
case "typeA":
return "URL鉴权A"
case "typeB":
return "URL鉴权B"
case "typeC":
return "URL鉴权C"
case "typeD":
return "URL鉴权D"
}
return ""
},
change: function () {
let that = this
setTimeout(function () {
// 延时通知,是为了让表单有机会变更数据
that.$emit("change", this.authConfig)
}, 100)
}
},
template: `<div>
@@ -59,7 +76,7 @@ Vue.component("http-auth-config-box", {
<prior-checkbox :v-config="authConfig" v-if="vIsLocation"></prior-checkbox>
<tbody v-show="!vIsLocation || authConfig.isPrior">
<tr>
<td class="title">启用认证</td>
<td class="title">启用鉴权</td>
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="authConfig.isOn"/>
@@ -70,14 +87,14 @@ Vue.component("http-auth-config-box", {
</tbody>
</table>
<div class="margin"></div>
<!-- 认证方式 -->
<!-- 鉴权方式 -->
<div v-show="isOn()">
<h4>认证方式</h4>
<h4>鉴权方式</h4>
<table class="ui table selectable celled" v-show="authConfig.policyRefs.length > 0">
<thead>
<tr>
<th class="three wide">名称</th>
<th class="three wide">认证方法</th>
<th class="three wide">鉴权方法</th>
<th>参数</th>
<th class="two wide">状态</th>
<th class="two op">操作</th>
@@ -95,6 +112,15 @@ Vue.component("http-auth-config-box", {
<span v-if="ref.authPolicy.params.method.length > 0" class="grey">[{{ref.authPolicy.params.method}}]</span>
{{ref.authPolicy.params.url}}
</span>
<span v-if="ref.authPolicy.type == 'typeA'">{{ref.authPolicy.params.signParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeB'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeC'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeD'">{{ref.authPolicy.params.signParamName}}/{{ref.authPolicy.params.timestampParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
<div v-if="(ref.authPolicy.params.exts != null && ref.authPolicy.params.exts.length > 0) || (ref.authPolicy.params.domains != null && ref.authPolicy.params.domains.length > 0)">
<grey-label v-if="ref.authPolicy.params.exts != null" v-for="ext in ref.authPolicy.params.exts">扩展名:{{ext}}</grey-label>
<grey-label v-if="ref.authPolicy.params.domains != null" v-for="domain in ref.authPolicy.params.domains">域名:{{domain}}</grey-label>
</div>
</td>
<td>
<label-on :v-is-on="ref.authPolicy.isOn"></label-on>
@@ -106,7 +132,7 @@ Vue.component("http-auth-config-box", {
</tr>
</tbody>
</table>
<button class="ui button small" type="button" @click.prevent="add">+添加认证方式</button>
<button class="ui button small" type="button" @click.prevent="add">+添加鉴权方式</button>
</div>
<div class="margin"></div>
</div>`

View File

@@ -58,6 +58,7 @@ div.comment {
color: rgba(0, 0, 0, 0.4);
padding-top: 0.4em;
font-weight: normal;
word-break: break-all;
}
p.comment em,
div.comment em {

View File

@@ -1 +1 @@
{"version":3,"sources":["@layout_popup.less"],"names":[],"mappings":";AACA;EACC,WAAA;;AAGD;EACC,aAAA;;AAGD;EACC,qBAAA;;AAGD,CAAC;AAAW,CAAC,SAAS;AAAQ,CAAC,SAAS;AAAS,IAAI;EACpD,WAAA;;AAGD,CAAC;AAAU,IAAI;AAAU,IAAI;EAC5B,cAAA;;AAGD,IAAI;AAAO,KAAK;AAAO,CAAC;EACvB,sBAAA;;AAGD,CAAC;EACA,iBAAA;;AAGD,IAAI;AAAM,GAAG;EACZ,c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;;AAGD,GAAG;EACF,8BAAA;;;AAID,QAAS;EACR,WAAA;EACA,kBAAA;;;AAID,SAAU,MAAM;AAAG,SAAU;EAC5B,gBAAA;;;AAID;EACC,eAAA;EAEA,2BAAA;;AAHD,KAKC;EACC,qBAAA;EACA,mBAAA;EACA,WAAA;EACA,iBAAA;EACA,SAAA;EACA,gBAAA;EACA,sBAAA;EACA,cAAA;;AAbF,KAgBC,EAAC;EACA,mBAAA;EACA,YAAA;;AAlBF,KAqBC,EAAC;EACA,gBAAA;;AAKF;EACC,kBAAA;;AAGD,cAAc;AAAQ,aAAa;AAAQ,YAAY;EACtD,sBAAA;;AAGD;AAAgB;AAAe;EAC9B,sBAAA;;AAGD;EACC,2BAAA;;AAID,KAAK;EACJ,yBAAA;;AAID,QAAQ;EACP,4BAA4B,wBAA5B;EACA,gBAAA;;AAID,UAAW;EACV,gBAAA;EACA,gBAAA;EACA,kBAAA;EACA,2CAAA;EACA,aAAA;EACA,YAAA;;AAGD,UAAW,MAAK;EACf,UAAA","file":"@layout_popup.css"}

View File

@@ -63,6 +63,7 @@ p.comment, div.comment {
color: rgba(0, 0, 0, 0.4);
padding-top: 0.4em;
font-weight: normal;
word-break: break-all;
}
p.comment em, div.comment em {

View File

@@ -1,6 +1,6 @@
{$layout "layout_popup"}
<h3>创建认证方式</h3>
<h3>创建鉴权方式</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
@@ -12,16 +12,118 @@
</td>
</tr>
<tr>
<td>认证类型 *</td>
<td>鉴权类型 *</td>
<td>
<select class="ui dropdown auto-width" name="type" v-model="type" @change="changeType">
<option value="">[认证类型]</option>
<option value="">[鉴权类型]</option>
<option v-for="authType in authTypes" :value="authType.code">{{authType.name}}</option>
</select>
<p class="comment" v-html="authDescription"></p>
</td>
</tr>
<!-- TypeA -->
<tbody v-show="type == 'typeA'">
<tr>
<td>鉴权密钥 *</td>
<td>
<input type="text" maxlength="40" name="typeASecret" v-model="typeASecret" autocomplete="off"/>
<p class="comment">只能包含字母、数字长度不超过40。<a href="" @click.prevent="generateTypeASecret()">[随机生成]</a></p>
</td>
</tr>
<tr>
<td>签名参数 *</td>
<td>
<input type="text" maxlength="30" name="typeASignParamName" value="sign" v-model="typeASignParamName" @input="changeTypeASignParamName"/>
</td>
</tr>
<tr>
<td>有效时间</td>
<td>
<div class="ui input right labeled">
<input type="text" maxlength="8" name="typeALife" value="30" style="width: 7em"/>
<span class="ui label"></span>
</div>
<p class="comment">链接有效时间。</p>
</td>
</tr>
</tbody>
<!-- TypeB -->
<tbody v-show="type == 'typeB'">
<tr>
<td>鉴权密钥 *</td>
<td>
<input type="text" maxlength="40" name="typeBSecret" v-model="typeBSecret" autocomplete="off"/>
<p class="comment">只能包含字母、数字长度不超过40。<a href="" @click.prevent="generateTypeBSecret()">[随机生成]</a></p>
</td>
</tr>
<tr>
<td>有效时间</td>
<td>
<div class="ui input right labeled">
<input type="text" maxlength="8" name="typeBLife" value="30" style="width: 7em"/>
<span class="ui label"></span>
</div>
<p class="comment">链接有效时间。</p>
</td>
</tr>
</tbody>
<!-- TypeC -->
<tbody v-show="type == 'typeC'">
<tr>
<td>鉴权密钥 *</td>
<td>
<input type="text" maxlength="40" name="typeCSecret" v-model="typeCSecret" autocomplete="off"/>
<p class="comment">只能包含字母、数字长度不超过40。<a href="" @click.prevent="generateTypeCSecret()">[随机生成]</a></p>
</td>
</tr>
<tr>
<td>有效时间</td>
<td>
<div class="ui input right labeled">
<input type="text" maxlength="8" name="typeCLife" value="30" style="width: 7em"/>
<span class="ui label"></span>
</div>
<p class="comment">链接有效时间。</p>
</td>
</tr>
</tbody>
<!-- TypeD -->
<tbody v-show="type == 'typeD'">
<tr>
<td>鉴权密钥 *</td>
<td>
<input type="text" maxlength="40" name="typeDSecret" v-model="typeDSecret" autocomplete="off"/>
<p class="comment">只能包含字母、数字长度不超过40。<a href="" @click.prevent="generateTypeDSecret()">[随机生成]</a></p>
</td>
</tr>
<tr>
<td>签名参数 *</td>
<td>
<input type="text" maxlength="30" name="typeDSignParamName" value="sign" v-model="typeDSignParamName" @input="changeTypeDSignParamName"/>
</td>
</tr>
<tr>
<td>时间戳参数 *</td>
<td>
<input type="text" maxlength="30" name="typeDTimestampParamName" value="t" v-model="typeDTimestampParamName" @input="changeTypeDTimestampParamName"/>
</td>
</tr>
<tr>
<td>有效时间</td>
<td>
<div class="ui input right labeled">
<input type="text" maxlength="8" name="typeDLife" value="30" style="width: 7em"/>
<span class="ui label"></span>
</div>
<p class="comment">链接有效时间。</p>
</td>
</tr>
</tbody>
<!-- BasicAuth -->
<tbody v-show="type == 'basicAuth'">
<tr>
@@ -32,7 +134,7 @@
</tr>
<tr>
<td colspan="2">
<a href="" @click.prevent="showMoreBasicAuthOptions()">更多选项<i class="ui icon angle" :class="{up: moreBasicAuthOptionsVisible, down: !moreBasicAuthOptionsVisible}"></i></a>
<a href="" @click.prevent="showMoreBasicAuthOptions()">更多基本认证选项<i class="ui icon angle" :class="{up: moreBasicAuthOptionsVisible, down: !moreBasicAuthOptionsVisible}"></i></a>
</td>
</tr>
<tr v-show="moreBasicAuthOptionsVisible">
@@ -76,6 +178,25 @@
</td>
</tr>
</tbody>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>限定文件扩展名</td>
<td>
<values-box name="exts"></values-box>
<p class="comment">如果不为空,则表示只有这些扩展名的文件才需要鉴权;扩展名需要包含点符号(.),比如<code-label>.png</code-label></p>
</td>
</tr>
<tr>
<td>限定域名</td>
<td>
<domains-box></domains-box>
<p class="comment">如果不为空,则表示只有这些域名的文件才需要鉴权。</p>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>

View File

@@ -3,6 +3,7 @@ Tea.context(function () {
this.type = ""
this.authDescription = ""
this.rawDescription = ""
this.changeType = function () {
let that = this
@@ -11,11 +12,78 @@ Tea.context(function () {
})
if (authType != null) {
this.authDescription = authType.description
this.rawDescription = authType.description
} else {
this.authDescription = ""
this.rawDescription = ""
}
}
/**
* TypeA
*/
this.typeASecret = ""
this.typeASignParamName = "sign"
this.generateTypeASecret = function () {
this.$post(".random")
.success(function (resp) {
this.typeASecret = resp.data.random
})
}
this.changeTypeASignParamName = function () {
this.authDescription = this.rawDescription.replace("sign=", this.typeASignParamName + "=")
}
/**
* TypeB
*/
this.typeBSecret = ""
this.generateTypeBSecret = function () {
this.$post(".random")
.success(function (resp) {
this.typeBSecret = resp.data.random
})
}
/**
* TypeC
*/
this.typeCSecret = ""
this.generateTypeCSecret = function () {
this.$post(".random")
.success(function (resp) {
this.typeCSecret = resp.data.random
})
}
/**
* TypeD
*/
this.typeDSecret = ""
this.typeDSignParamName = "sign"
this.typeDTimestampParamName = "t"
this.generateTypeDSecret = function () {
this.$post(".random")
.success(function (resp) {
this.typeDSecret = resp.data.random
})
}
this.changeTypeDSignParamName = function () {
this.authDescription = this.rawDescription.replace("sign=", this.typeDSignParamName + "=")
this.authDescription = this.authDescription.replace("t=", this.typeDTimestampParamName + "=")
}
this.changeTypeDTimestampParamName = function () {
this.authDescription = this.rawDescription.replace("sign=", this.typeDSignParamName + "=")
this.authDescription = this.authDescription.replace("t=", this.typeDTimestampParamName + "=")
}
/**
* 基本认证
*/

View File

@@ -3,10 +3,10 @@
{$template "/left_menu_with_menu"}
<div class="right-box with-menu">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<form class="ui form" data-tea-action="$" data-tea-success="success" ref="authForm">
<csrf-token></csrf-token>
<input type="hidden" name="webId" :value="webId">
<http-auth-config-box :v-auth-config="authConfig"></http-auth-config-box>
<submit-btn></submit-btn>
<http-auth-config-box :v-auth-config="authConfig" @change="changeMethods"></http-auth-config-box>
<submit-btn @ref=""></submit-btn>
</form>
</div>

View File

@@ -1,3 +1,10 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
this.changeMethods = function (config) {
Tea.action("$")
.form(this.$refs.authForm)
.post()
teaweb.successRefresh("保存成功")
}
})

View File

@@ -1,6 +1,6 @@
{$layout "layout_popup"}
<h3>修改认证方式</h3>
<h3>修改鉴权方式</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="policyId" :value="policy.id"/>
@@ -13,13 +13,115 @@
</td>
</tr>
<tr>
<td>认证类型 *</td>
<td>鉴权类型 *</td>
<td>
{{policy.typeName}}
<p class="comment" v-html="authDescription"></p>
</td>
</tr>
<!-- TypeA -->
<tbody v-show="type == 'typeA'">
<tr>
<td>鉴权密钥 *</td>
<td>
<input type="text" maxlength="40" name="typeASecret" v-model="typeASecret" autocomplete="off"/>
<p class="comment">只能包含字母、数字长度不超过40。<a href="" @click.prevent="generateTypeASecret()">[随机生成]</a></p>
</td>
</tr>
<tr>
<td>签名参数 *</td>
<td>
<input type="text" maxlength="30" name="typeASignParamName" value="sign" v-model="typeASignParamName" @input="changeTypeASignParamName"/>
</td>
</tr>
<tr>
<td>有效时间</td>
<td>
<div class="ui input right labeled">
<input type="text" maxlength="8" name="typeALife" value="30" style="width: 7em" v-model="policy.params.life"/>
<span class="ui label"></span>
</div>
<p class="comment">链接有效时间。</p>
</td>
</tr>
</tbody>
<!-- TypeB -->
<tbody v-show="type == 'typeB'">
<tr>
<td>鉴权密钥 *</td>
<td>
<input type="text" maxlength="40" name="typeBSecret" v-model="typeBSecret" autocomplete="off"/>
<p class="comment">只能包含字母、数字长度不超过40。<a href="" @click.prevent="generateTypeBSecret()">[随机生成]</a></p>
</td>
</tr>
<tr>
<td>有效时间</td>
<td>
<div class="ui input right labeled">
<input type="text" maxlength="8" name="typeBLife" value="30" style="width: 7em" v-model="policy.params.life"/>
<span class="ui label"></span>
</div>
<p class="comment">链接有效时间。</p>
</td>
</tr>
</tbody>
<!-- TypeC -->
<tbody v-show="type == 'typeC'">
<tr>
<td>鉴权密钥 *</td>
<td>
<input type="text" maxlength="40" name="typeCSecret" v-model="typeCSecret" autocomplete="off"/>
<p class="comment">只能包含字母、数字长度不超过40。<a href="" @click.prevent="generateTypeCSecret()">[随机生成]</a></p>
</td>
</tr>
<tr>
<td>有效时间</td>
<td>
<div class="ui input right labeled">
<input type="text" maxlength="8" name="typeCLife" value="30" style="width: 7em" v-model="policy.params.life"/>
<span class="ui label"></span>
</div>
<p class="comment">链接有效时间。</p>
</td>
</tr>
</tbody>
<!-- TypeD -->
<tbody v-show="type == 'typeD'">
<tr>
<td>鉴权密钥 *</td>
<td>
<input type="text" maxlength="40" name="typeDSecret" v-model="typeDSecret" autocomplete="off"/>
<p class="comment">只能包含字母、数字长度不超过40。<a href="" @click.prevent="generateTypeDSecret()">[随机生成]</a></p>
</td>
</tr>
<tr>
<td>签名参数 *</td>
<td>
<input type="text" maxlength="30" name="typeDSignParamName" value="sign" v-model="typeDSignParamName" @input="changeTypeDSignParamName"/>
</td>
</tr>
<tr>
<td>时间戳参数 *</td>
<td>
<input type="text" maxlength="30" name="typeDTimestampParamName" value="t" v-model="typeDTimestampParamName" @input="changeTypeDTimestampParamName"/>
</td>
</tr>
<tr>
<td>有效时间</td>
<td>
<div class="ui input right labeled">
<input type="text" maxlength="8" name="typeDLife" value="30" style="width: 7em" v-model="policy.params.life"/>
<span class="ui label"></span>
</div>
<p class="comment">链接有效时间。</p>
</td>
</tr>
</tbody>
<!-- BasicAuth -->
<tbody v-show="type == 'basicAuth'">
<tr>
@@ -30,7 +132,7 @@
</tr>
<tr>
<td colspan="2">
<a href="" @click.prevent="showMoreBasicAuthOptions()">更多选项<i class="ui icon angle" :class="{up: moreBasicAuthOptionsVisible, down: !moreBasicAuthOptionsVisible}"></i></a>
<a href="" @click.prevent="showMoreBasicAuthOptions()">更多基本认证选项<i class="ui icon angle" :class="{up: moreBasicAuthOptionsVisible, down: !moreBasicAuthOptionsVisible}"></i></a>
</td>
</tr>
<tr v-show="moreBasicAuthOptionsVisible">
@@ -76,9 +178,28 @@
</tr>
</tbody>
<tr>
<td>是否启用</td>
<td><checkbox name="isOn" value="1" v-model="policy.isOn"></checkbox></td>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>限定文件扩展名</td>
<td>
<values-box name="exts" :v-values="policy.params.exts"></values-box>
<p class="comment">如果不为空,则表示只有这些扩展名的文件才需要鉴权;扩展名需要包含点符号(.),比如<code-label>.png</code-label></p>
</td>
</tr>
<tr>
<td>限定域名</td>
<td>
<domains-box :v-domains="policy.params.domains"></domains-box>
<p class="comment">如果不为空,则表示只有这些域名的文件才需要鉴权。</p>
</td>
</tr>
<tr>
<td>是否启用</td>
<td><checkbox name="isOn" value="1" v-model="policy.isOn"></checkbox></td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>

View File

@@ -3,6 +3,7 @@ Tea.context(function () {
this.type = this.policy.type
this.authDescription = ""
this.rawDescription = ""
this.$delay(function () {
this.changeType()
@@ -16,13 +17,106 @@ Tea.context(function () {
if (authType != null) {
this.policy.typeName = authType.name
this.authDescription = authType.description
this.rawDescription = authType.description
} else {
this.authDescription = ""
this.rawDescription = ""
}
}
/**
* 基本认证
* TypeA
*/
this.typeASecret = ""
this.typeASignParamName = "sign"
if (this.policy.type == "typeA") {
this.typeASecret = this.policy.params.secret
this.typeASignParamName = this.policy.params.signParamName
this.$delay(function () {
this.changeTypeASignParamName()
})
}
this.generateTypeASecret = function () {
this.$post(".random")
.success(function (resp) {
this.typeASecret = resp.data.random
})
}
this.changeTypeASignParamName = function () {
this.authDescription = this.rawDescription.replace("sign=", this.typeASignParamName + "=")
}
/**
* TypeB
*/
this.typeBSecret = ""
if (this.policy.type == "typeB") {
this.typeBSecret = this.policy.params.secret
}
this.generateTypeBSecret = function () {
this.$post(".random")
.success(function (resp) {
this.typeBSecret = resp.data.random
})
}
/**
* TypeC
*/
this.typeCSecret = ""
if (this.policy.type == "typeC") {
this.typeCSecret = this.policy.params.secret
}
this.generateTypeCSecret = function () {
this.$post(".random")
.success(function (resp) {
this.typeCSecret = resp.data.random
})
}
/**
* TypeD
*/
this.typeDSecret = ""
this.typeDSignParamName = "sign"
this.typeDTimestampParamName = "t"
if (this.policy.type == "typeD") {
this.typeDSecret = this.policy.params.secret
this.typeDSignParamName = this.policy.params.signParamName
this.typeDTimestampParamName = this.policy.params.timestampParamName
this.$delay(function () {
this.changeTypeDSignParamName()
this.changeTypeDTimestampParamName()
})
}
this.generateTypeDSecret = function () {
this.$post(".random")
.success(function (resp) {
this.typeDSecret = resp.data.random
})
}
this.changeTypeDSignParamName = function () {
this.authDescription = this.rawDescription.replace("sign=", this.typeDSignParamName + "=")
this.authDescription = this.authDescription.replace("t=", this.typeDTimestampParamName + "=")
}
this.changeTypeDTimestampParamName = function () {
this.authDescription = this.rawDescription.replace("sign=", this.typeDSignParamName + "=")
this.authDescription = this.authDescription.replace("t=", this.typeDTimestampParamName + "=")
}
/**
* 基本鉴权
*/
this.moreBasicAuthOptionsVisible = false

View File

@@ -6,10 +6,10 @@
{$template "../left_menu"}
<div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<form class="ui form" data-tea-action="$" data-tea-success="success" ref="authForm">
<csrf-token></csrf-token>
<input type="hidden" name="webId" :value="webId">
<http-auth-config-box :v-auth-config="authConfig" :v-is-location="true"></http-auth-config-box>
<http-auth-config-box :v-auth-config="authConfig" :v-is-location="true" @change="changeMethods"></http-auth-config-box>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -1,3 +1,10 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
this.changeMethods = function (config) {
Tea.action("$")
.form(this.$refs.authForm)
.post()
teaweb.successRefresh("保存成功")
}
})