You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

oauth2-oauth2.js 13KB

123
  1. /*! For license information please see oauth2-oauth2.js.LICENSE.txt */
  2. (()=>{"use strict";var e,n={62411:(e,n,r)=>{var i=r(20144),a=r(4820);const o={name:"OAuthItem",props:{client:{type:Object,required:!0}},data(){return{id:this.client.id,name:this.client.name,redirectUri:this.client.redirectUri,clientId:this.client.clientId,clientSecret:this.client.clientSecret,renderSecret:!1}},computed:{renderedSecret(){return this.renderSecret?this.clientSecret:"****"}},methods:{toggleSecret(){this.renderSecret=!this.renderSecret}}};var s=r(93379),l=r.n(s),d=r(72580);l()(d.Z,{insert:"head",singleton:!1}),d.Z.locals;var c=r(51900);const u=(0,c.Z)(o,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("tr",[n("td",[n("table",{staticClass:"inline"},[n("tr",[n("td",[t._v(t._s(t.t("oauth2","Name")))]),t._v(" "),n("td",[t._v(t._s(t.name))])]),t._v(" "),n("tr",[n("td",[t._v(t._s(t.t("oauth2","Redirection URI")))]),t._v(" "),n("td",[t._v(t._s(t.redirectUri))])]),t._v(" "),n("tr",[n("td",[t._v(t._s(t.t("oauth2","Client Identifier")))]),t._v(" "),n("td",[n("code",[t._v(t._s(t.clientId))])])]),t._v(" "),n("tr",[n("td",[t._v(t._s(t.t("oauth2","Secret")))]),t._v(" "),n("td",[n("code",[t._v(t._s(t.renderedSecret))]),n("a",{staticClass:"icon-toggle has-tooltip",attrs:{title:t.t("oauth2","Show client secret")},on:{click:t.toggleSecret}})])])])]),t._v(" "),n("td",{staticClass:"action-column"},[n("span",[n("a",{staticClass:"icon-delete has-tooltip",attrs:{title:t.t("oauth2","Delete")},on:{click:function(e){return t.$emit("delete",t.id)}}})])])])}),[],!1,null,"665ff3f1",null).exports;var h=r(79753);const p={name:"App",components:{OAuthItem:u},props:{clients:{type:Array,required:!0}},data:()=>({newClient:{name:"",redirectUri:"",errorMsg:"",error:!1}}),methods:{deleteClient(t){a.default.delete((0,h.generateUrl)("apps/oauth2/clients/{id}",{id:t})).then((e=>{this.clients=this.clients.filter((e=>e.id!==t))}))},addClient(){this.newClient.error=!1,a.default.post((0,h.generateUrl)("apps/oauth2/clients"),{name:this.newClient.name,redirectUri:this.newClient.redirectUri}).then((t=>{this.clients.push(t.data),this.newClient.name="",this.newClient.redirectUri=""})).catch((t=>{this.newClient.error=!0,this.newClient.errorMsg=t.response.data.message}))}}};var m=r(39720);l()(m.Z,{insert:"head",singleton:!1}),m.Z.locals;const A=(0,c.Z)(p,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"section",attrs:{id:"oauth2"}},[n("h2",[t._v(t._s(t.t("oauth2","OAuth 2.0 clients")))]),t._v(" "),n("p",{staticClass:"settings-hint"},[t._v("\n\t\t\t"+t._s(t.t("oauth2","OAuth 2.0 allows external services to request access to {instanceName}.",{instanceName:t.OC.theme.name}))+"\n\t\t")]),t._v(" "),t.clients.length>0?n("table",{staticClass:"grid"},[t._m(0),t._v(" "),n("tbody",t._l(t.clients,(function(e){return n("OAuthItem",{key:e.id,attrs:{client:e},on:{delete:t.deleteClient}})})),1)]):t._e(),t._v(" "),n("br"),t._v(" "),n("h3",[t._v(t._s(t.t("oauth2","Add client")))]),t._v(" "),t.newClient.error?n("span",{staticClass:"msg error"},[t._v(t._s(t.newClient.errorMsg))]):t._e(),t._v(" "),n("form",{on:{submit:function(e){return e.preventDefault(),t.addClient.apply(null,arguments)}}},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.newClient.name,expression:"newClient.name"}],attrs:{id:"name",type:"text",name:"name",placeholder:t.t("oauth2","Name")},domProps:{value:t.newClient.name},on:{input:function(e){e.target.composing||t.$set(t.newClient,"name",e.target.value)}}}),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.newClient.redirectUri,expression:"newClient.redirectUri"}],attrs:{id:"redirectUri",type:"url",name:"redirectUri",placeholder:t.t("oauth2","Redirection URI")},domProps:{value:t.newClient.redirectUri},on:{input:function(e){e.target.composing||t.$set(t.newClient,"redirectUri",e.target.value)}}}),t._v(" "),n("input",{staticClass:"button",attrs:{type:"submit"},domProps:{value:t.t("oauth2","Add")}})])])}),[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("thead",[n("tr",[n("th",{attrs:{id:"headerContent"}}),t._v(" "),n("th",{attrs:{id:"headerRemove"}},[t._v("\n \n\t\t\t\t\t")])])])}],!1,null,"7098866e",null).exports;var f=r(16453);i.default.prototype.t=t,i.default.prototype.OC=OC;const v=(0,f.loadState)("oauth2","clients");new(i.default.extend(A))({propsData:{clients:v}}).$mount("#oauth2")},39720:(t,e,n)=>{n.d(e,{Z:()=>s});var r=n(94015),i=n.n(r),a=n(23645),o=n.n(a)()(i());o.push([t.id,"\ntable[data-v-7098866e] {\n\tmax-width: 800px;\n}\n","",{version:3,sources:["webpack://./apps/oauth2/src/App.vue"],names:[],mappings:";AAyHA;CACA,gBAAA;AACA",sourcesContent:['\x3c!--\n - @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>\n -\n - @author Roeland Jago Douma <roeland@famdouma.nl>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n --\x3e\n<template>\n\t<div id="oauth2" class="section">\n\t\t<h2>{{ t(\'oauth2\', \'OAuth 2.0 clients\') }}</h2>\n\t\t<p class="settings-hint">\n\t\t\t{{ t(\'oauth2\', \'OAuth 2.0 allows external services to request access to {instanceName}.\', { instanceName: OC.theme.name}) }}\n\t\t</p>\n\t\t<table v-if="clients.length > 0" class="grid">\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th id="headerContent" />\n\t\t\t\t\t<th id="headerRemove">\n&nbsp;\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t\t<OAuthItem v-for="client in clients"\n\t\t\t\t\t:key="client.id"\n\t\t\t\t\t:client="client"\n\t\t\t\t\t@delete="deleteClient" />\n\t\t\t</tbody>\n\t\t</table>\n\n\t\t<br>\n\t\t<h3>{{ t(\'oauth2\', \'Add client\') }}</h3>\n\t\t<span v-if="newClient.error" class="msg error">{{ newClient.errorMsg }}</span>\n\t\t<form @submit.prevent="addClient">\n\t\t\t<input id="name"\n\t\t\t\tv-model="newClient.name"\n\t\t\t\ttype="text"\n\t\t\t\tname="name"\n\t\t\t\t:placeholder="t(\'oauth2\', \'Name\')">\n\t\t\t<input id="redirectUri"\n\t\t\t\tv-model="newClient.redirectUri"\n\t\t\t\ttype="url"\n\t\t\t\tname="redirectUri"\n\t\t\t\t:placeholder="t(\'oauth2\', \'Redirection URI\')">\n\t\t\t<input type="submit" class="button" :value="t(\'oauth2\', \'Add\')">\n\t\t</form>\n\t</div>\n</template>\n\n<script>\nimport axios from \'@nextcloud/axios\'\nimport OAuthItem from \'./components/OAuthItem\'\nimport { generateUrl } from \'@nextcloud/router\'\n\nexport default {\n\tname: \'App\',\n\tcomponents: {\n\t\tOAuthItem,\n\t},\n\tprops: {\n\t\tclients: {\n\t\t\ttype: Array,\n\t\t\trequired: true,\n\t\t},\n\t},\n\tdata() {\n\t\treturn {\n\t\t\tnewClient: {\n\t\t\t\tname: \'\',\n\t\t\t\tredirectUri: \'\',\n\t\t\t\terrorMsg: \'\',\n\t\t\t\terror: false,\n\t\t\t},\n\t\t}\n\t},\n\tmethods: {\n\t\tdeleteClient(id) {\n\t\t\taxios.delete(generateUrl(\'apps/oauth2/clients/{id}\', { id }))\n\t\t\t\t.then((response) => {\n\t\t\t\t\t// eslint-disable-next-line vue/no-mutating-props\n\t\t\t\t\tthis.clients = this.clients.filter(client => client.id !== id)\n\t\t\t\t})\n\t\t},\n\t\taddClient() {\n\t\t\tthis.newClient.error = false\n\n\t\t\taxios.post(\n\t\t\t\tgenerateUrl(\'apps/oauth2/clients\'),\n\t\t\t\t{\n\t\t\t\t\tname: this.newClient.name,\n\t\t\t\t\tredirectUri: this.newClient.redirectUri,\n\t\t\t\t}\n\t\t\t).then(response => {\n\t\t\t\t// eslint-disable-next-line vue/no-mutating-props\n\t\t\t\tthis.clients.push(response.data)\n\n\t\t\t\tthis.newClient.name = \'\'\n\t\t\t\tthis.newClient.redirectUri = \'\'\n\t\t\t}).catch(reason => {\n\t\t\t\tthis.newClient.error = true\n\t\t\t\tthis.newClient.errorMsg = reason.response.data.message\n\t\t\t})\n\t\t},\n\t},\n}\n<\/script>\n<style scoped>\n\ttable {\n\t\tmax-width: 800px;\n\t}\n</style>\n'],sourceRoot:""}]);const s=o},72580:(t,e,n)=>{n.d(e,{Z:()=>s});var r=n(94015),i=n.n(r),a=n(23645),o=n.n(a)()(i());o.push([t.id,"\n.icon-toggle[data-v-665ff3f1],\n.icon-delete[data-v-665ff3f1] {\n\tdisplay: inline-block;\n\twidth: 16px;\n\theight: 16px;\n\tpadding: 10px;\n\tvertical-align: middle;\n}\ntd code[data-v-665ff3f1] {\n\tdisplay: inline-block;\n\tvertical-align: middle;\n}\ntable.inline td[data-v-665ff3f1] {\n\tborder: none;\n\tpadding: 5px;\n}\n","",{version:3,sources:["webpack://./apps/oauth2/src/components/OAuthItem.vue"],names:[],mappings:";AAsFA;;CAEA,qBAAA;CACA,WAAA;CACA,YAAA;CACA,aAAA;CACA,sBAAA;AACA;AACA;CACA,qBAAA;CACA,sBAAA;AACA;AACA;CACA,YAAA;CACA,YAAA;AACA",sourcesContent:["\x3c!--\n - @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>\n -\n - @author Roeland Jago Douma <roeland@famdouma.nl>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n --\x3e\n<template>\n\t<tr>\n\t\t<td>\n\t\t\t<table class=\"inline\">\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{{ t('oauth2', 'Name') }}</td>\n\t\t\t\t\t<td>{{ name }}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{{ t('oauth2', 'Redirection URI') }}</td>\n\t\t\t\t\t<td>{{ redirectUri }}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{{ t('oauth2', 'Client Identifier') }}</td>\n\t\t\t\t\t<td><code>{{ clientId }}</code></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{{ t('oauth2', 'Secret') }}</td>\n\t\t\t\t\t<td><code>{{ renderedSecret }}</code><a class=\"icon-toggle has-tooltip\" :title=\"t('oauth2', 'Show client secret')\" @click=\"toggleSecret\" /></td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t<td class=\"action-column\">\n\t\t\t<span><a class=\"icon-delete has-tooltip\" :title=\"t('oauth2', 'Delete')\" @click=\"$emit('delete', id)\" /></span>\n\t\t</td>\n\t</tr>\n</template>\n\n<script>\nexport default {\n\tname: 'OAuthItem',\n\tprops: {\n\t\tclient: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\t},\n\tdata() {\n\t\treturn {\n\t\t\tid: this.client.id,\n\t\t\tname: this.client.name,\n\t\t\tredirectUri: this.client.redirectUri,\n\t\t\tclientId: this.client.clientId,\n\t\t\tclientSecret: this.client.clientSecret,\n\t\t\trenderSecret: false,\n\t\t}\n\t},\n\tcomputed: {\n\t\trenderedSecret() {\n\t\t\tif (this.renderSecret) {\n\t\t\t\treturn this.clientSecret\n\t\t\t} else {\n\t\t\t\treturn '****'\n\t\t\t}\n\t\t},\n\t},\n\tmethods: {\n\t\ttoggleSecret() {\n\t\t\tthis.renderSecret = !this.renderSecret\n\t\t},\n\t},\n}\n<\/script>\n\n<style scoped>\n\t.icon-toggle,\n\t.icon-delete {\n\t\tdisplay: inline-block;\n\t\twidth: 16px;\n\t\theight: 16px;\n\t\tpadding: 10px;\n\t\tvertical-align: middle;\n\t}\n\ttd code {\n\t\tdisplay: inline-block;\n\t\tvertical-align: middle;\n\t}\n\ttable.inline td {\n\t\tborder: none;\n\t\tpadding: 5px;\n\t}\n</style>\n"],sourceRoot:""}]);const s=o}},r={};function i(t){var e=r[t];if(void 0!==e)return e.exports;var a=r[t]={id:t,loaded:!1,exports:{}};return n[t].call(a.exports,a,a.exports,i),a.loaded=!0,a.exports}i.m=n,i.amdD=function(){throw new Error("define cannot be used indirect")},i.amdO={},e=[],i.O=(t,n,r,a)=>{if(!n){var o=1/0;for(c=0;c<e.length;c++){n=e[c][0],r=e[c][1],a=e[c][2];for(var s=!0,l=0;l<n.length;l++)(!1&a||o>=a)&&Object.keys(i.O).every((t=>i.O[t](n[l])))?n.splice(l--,1):(s=!1,a<o&&(o=a));if(s){e.splice(c--,1);var d=r();void 0!==d&&(t=d)}}return t}a=a||0;for(var c=e.length;c>0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[n,r,a]},i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),i.j=53,(()=>{var t={53:0};i.O.j=e=>0===t[e];var e=(e,n)=>{var r,a,o=n[0],s=n[1],l=n[2],d=0;if(o.some((e=>0!==t[e]))){for(r in s)i.o(s,r)&&(i.m[r]=s[r]);if(l)var c=l(i)}for(e&&e(n);d<o.length;d++)a=o[d],i.o(t,a)&&t[a]&&t[a][0](),t[o[d]]=0;return i.O(c)},n=self.webpackChunknextcloud=self.webpackChunknextcloud||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var a=i.O(void 0,[820],(()=>i(62411)));a=i.O(a)})();
  3. //# sourceMappingURL=oauth2-oauth2.js.map?v=848f982587ba141c8e36