profile updates
This commit is contained in:
parent
980895992a
commit
ece06b8463
10
index.html
10
index.html
|
@ -149,7 +149,15 @@
|
||||||
<p>A (mostly) client-side authentication and authorization framework for decentralized peer-to-peer and federated networks.
|
<p>A (mostly) client-side authentication and authorization framework for decentralized peer-to-peer and federated networks.
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<a class="btn btn-primary" href="playground.html">Enter the OAuth3 Playground</a>
|
<div>
|
||||||
|
<h2>OAuth3 Test Bed</h2>
|
||||||
|
<!--
|
||||||
|
<a class="btn btn-primary" href="azp.html">Demo Authorized Party</a>
|
||||||
|
<a class="btn btn-primary" href="issuer.html">Demo Issuer</a>
|
||||||
|
-->
|
||||||
|
<a class="btn btn-primary" href="playground.html">Demo Authorized Party</a>
|
||||||
|
<a class="btn btn-primary" href="playground.html">Demo Issuer</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h2>Private, Peer-to-Peer, Anonymous: Pick any two... at a time</h2>
|
<h2>Private, Peer-to-Peer, Anonymous: Pick any two... at a time</h2>
|
||||||
|
|
|
@ -94,6 +94,9 @@ $(function () {
|
||||||
// deprecated
|
// deprecated
|
||||||
'oauth3_authn': "Basic secure authentication"
|
'oauth3_authn': "Basic secure authentication"
|
||||||
, 'auth@oauth3.org': "Basic secure authentication"
|
, 'auth@oauth3.org': "Basic secure authentication"
|
||||||
|
, 'profile@oauth3.org': "Basic profile information"
|
||||||
|
, 'profile.email@oauth3.org': "Email address"
|
||||||
|
, 'profile.phone@oauth3.org': "Phone number"
|
||||||
, 'wallet': "Access to payments and subscriptions"
|
, 'wallet': "Access to payments and subscriptions"
|
||||||
, 'bucket': "Access to file storage"
|
, 'bucket': "Access to file storage"
|
||||||
, 'db': "Access to app data"
|
, 'db': "Access to app data"
|
||||||
|
|
137
js/playground.js
137
js/playground.js
|
@ -4,27 +4,27 @@
|
||||||
window.ngOauth3App = angular.module('oauth3Playground', [ 'oauth3.org' ])
|
window.ngOauth3App = angular.module('oauth3Playground', [ 'oauth3.org' ])
|
||||||
//window.ngOauth3App = angular.module('oauth3Playground', [ 'ui.router' ])
|
//window.ngOauth3App = angular.module('oauth3Playground', [ 'ui.router' ])
|
||||||
/*
|
/*
|
||||||
ngOauth3App.config(function($stateProvider) {
|
ngOauth3App.config(function($stateProvider) {
|
||||||
var helloState = {
|
var helloState = {
|
||||||
name: 'hello',
|
name: 'hello',
|
||||||
url: '/hello',
|
url: '/hello',
|
||||||
template: '<h3>hello world!</h3>'
|
template: '<h3>hello world!</h3>'
|
||||||
}
|
}
|
||||||
|
|
||||||
var aboutState = {
|
var aboutState = {
|
||||||
name: 'about',
|
name: 'about',
|
||||||
url: '/about',
|
url: '/about',
|
||||||
template: '<h3>Its the UI-Router hello world app!</h3>'
|
template: '<h3>Its the UI-Router hello world app!</h3>'
|
||||||
}
|
}
|
||||||
|
|
||||||
$stateProvider.state(helloState);
|
$stateProvider.state(helloState);
|
||||||
$stateProvider.state(aboutState);
|
$stateProvider.state(aboutState);
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
.controller('PlaygroundCtrl', [ '$timeout', 'azp@oauth3.org', function ($timeout, OAUTH3) {
|
.controller('PlaygroundCtrl', [ '$timeout', 'azp@oauth3.org', function ($timeout, OAUTH3) {
|
||||||
// NOTE: This OAUTH3 is the same as window.OAUTH3, but with angular's promise injected
|
// NOTE: This OAUTH3 is the same as window.OAUTH3, but with angular's promise injected
|
||||||
// TODO: how to load more than one version of oauth3 on the page (i.e. a vanilla version without angular entaglement)
|
// TODO: how to load more than one version of oauth3 on the page (i.e. a vanilla version without angular entaglement)
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.framework = 'none';
|
vm.framework = 'none';
|
||||||
vm.clientUri = OAUTH3.clientUri({ host: window.location.host });
|
vm.clientUri = OAUTH3.clientUri({ host: window.location.host });
|
||||||
|
@ -33,13 +33,18 @@
|
||||||
// map of things being debounced presently
|
// map of things being debounced presently
|
||||||
vm.debouncing = {};
|
vm.debouncing = {};
|
||||||
vm.defaults = { provider: vm.conf.provider_uri, directives: null };
|
vm.defaults = { provider: vm.conf.provider_uri, directives: null };
|
||||||
vm.defaults.scopes = [
|
vm.defaults.scopes = [
|
||||||
{ name: 'oauth3_authn', desc: "Basic secure authentication", checked: true }
|
{ name: 'profile@oauth3.org', desc: "Basic profile information", checked: true }
|
||||||
//{ name: 'authn@oauth3.org', desc: "Basic secure authentication" }
|
, { name: 'oauth3_authn', desc: "Basic secure authentication", checked: true }
|
||||||
, { name: 'photos@daplie.com', desc: "Access to photos" }
|
//{ name: 'authn@oauth3.org', desc: "Basic secure authentication" }
|
||||||
, { name: 'dns', desc: "DNS records (A/AAAA, TXT, SRV, MX, etc)" }
|
, { name: 'photos@daplie.com', desc: "Access to photos" }
|
||||||
, { name: '*', desc: "FULL ACCOUNT ACCESS" }
|
, { name: 'profile@oauth3.org', desc: "Access to basic profile info such as username, display_name, etc" }
|
||||||
];
|
, { name: 'dns', desc: "DNS records (A/AAAA, TXT, SRV, MX, etc)" }
|
||||||
|
, { name: '*', desc: "FULL ACCOUNT ACCESS" }
|
||||||
|
//, 'auth@oauth3.org': "Basic secure authentication"
|
||||||
|
//, 'profile.email@oauth3.org': "Email address"
|
||||||
|
//, 'profile.phone@oauth3.org': "Phone number"
|
||||||
|
];
|
||||||
|
|
||||||
vm.form = {};
|
vm.form = {};
|
||||||
vm.form.id = 'coolaj86@gmail.com';
|
vm.form.id = 'coolaj86@gmail.com';
|
||||||
|
@ -420,6 +425,44 @@
|
||||||
vm.session = session;
|
vm.session = session;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vm.urls.profile = {};
|
||||||
|
vm.api.urls.profile_get = function () {
|
||||||
|
if (!vm.directives || !vm.accessToken) { return; }
|
||||||
|
vm.urls.profile_get = OAUTH3.urls.accounts.get(vm.directives, vm.ropSession);
|
||||||
|
};
|
||||||
|
vm.api.profile = {};
|
||||||
|
vm.api.profile_get = function () {
|
||||||
|
console.log('you tickled me!', vm.ropSession);
|
||||||
|
vm.api.urls.profile_get();
|
||||||
|
return OAUTH3.requests.accounts.get(vm.directives, vm.ropSession).then(function (resp) {
|
||||||
|
console.log('you tickled me twice!');
|
||||||
|
if (!resp.data) {
|
||||||
|
resp = { status: 0, data: resp };
|
||||||
|
}
|
||||||
|
vm.responses.profile_get = resp;
|
||||||
|
}, function (err) {
|
||||||
|
console.error('Could not get profile:');
|
||||||
|
console.error(err);
|
||||||
|
vm.error = err;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
vm.api.profile_set = function () {
|
||||||
|
console.log('you tickled me!', vm.ropSession);
|
||||||
|
vm.api.urls.profile_set();
|
||||||
|
return OAUTH3.requests.accounts.set(vm.directives, vm.ropSession).then(function (resp) {
|
||||||
|
console.log('you tickled me twice!');
|
||||||
|
if (!resp.data) {
|
||||||
|
resp = { status: 0, data: resp };
|
||||||
|
}
|
||||||
|
vm.responses.profile_set = resp;
|
||||||
|
}, function (err) {
|
||||||
|
console.error('Could not set profile:');
|
||||||
|
console.error(err);
|
||||||
|
vm.error = err;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
vm.api.authz = {};
|
vm.api.authz = {};
|
||||||
vm.api.authz._grantsOpts = function () {
|
vm.api.authz._grantsOpts = function () {
|
||||||
return vm.api.authz._grantsOpts_ = {
|
return vm.api.authz._grantsOpts_ = {
|
||||||
|
@ -456,35 +499,35 @@
|
||||||
vm.fn.updateScopes();
|
vm.fn.updateScopes();
|
||||||
|
|
||||||
vm.apistr = '';
|
vm.apistr = '';
|
||||||
Object.keys(OAUTH3).forEach(function (key) {
|
Object.keys(OAUTH3).forEach(function (key) {
|
||||||
var thingy = OAUTH3[key];
|
var thingy = OAUTH3[key];
|
||||||
|
|
||||||
if ('_' === key[0] || -1 !== [ 'create', '_browser', '_defaultStorage', 'hooks', '_hooks', '_digest' ].indexOf(key)) {
|
if ('_' === key[0] || -1 !== [ 'create', '_browser', '_defaultStorage', 'hooks', '_hooks', '_digest' ].indexOf(key)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('function' === typeof thingy) {
|
if ('function' === typeof thingy) {
|
||||||
vm.apistr += thingy.toString().split(/\n/)[0].replace('function ', 'OAUTH3.' + key).replace(/\s+{\s*/, '') + '\n';
|
vm.apistr += thingy.toString().split(/\n/)[0].replace('function ', 'OAUTH3.' + key).replace(/\s+{\s*/, '') + '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('object' === typeof thingy) {
|
if ('object' === typeof thingy) {
|
||||||
Object.keys(thingy).forEach(function (key2) {
|
Object.keys(thingy).forEach(function (key2) {
|
||||||
var thingy2 = thingy[key2];
|
var thingy2 = thingy[key2];
|
||||||
if ('function' === typeof thingy2) {
|
if ('function' === typeof thingy2) {
|
||||||
vm.apistr += thingy2.toString().split(/\n/)[0].replace('function ', 'OAUTH3.' + key + '.' + key2).replace(/\s+{\s*/, '') + '\n';
|
vm.apistr += thingy2.toString().split(/\n/)[0].replace('function ', 'OAUTH3.' + key + '.' + key2).replace(/\s+{\s*/, '') + '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('object' === typeof thingy2) {
|
if ('object' === typeof thingy2) {
|
||||||
Object.keys(thingy2).forEach(function (key3) {
|
Object.keys(thingy2).forEach(function (key3) {
|
||||||
var thingy3 = thingy2[key3];
|
var thingy3 = thingy2[key3];
|
||||||
if ('function' === typeof thingy3) {
|
if ('function' === typeof thingy3) {
|
||||||
vm.apistr += thingy3.toString().split(/\n/)[0].replace('function ', 'OAUTH3.' + key + '.' + key2 + '.' + key3).replace(/\s+{\s*/, '') + '\n';
|
vm.apistr += thingy3.toString().split(/\n/)[0].replace('function ', 'OAUTH3.' + key + '.' + key2 + '.' + key3).replace(/\s+{\s*/, '') + '\n';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} ] );
|
} ] );
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -146,8 +146,11 @@ ng-if="'none' === vm.framework || 'jquery' === vm.framework"></span><span ng-if=
|
||||||
<pre><code>OAUTH3.discover("<span ng-bind="vm.form.provider"></span>", opts);</code></pre>
|
<pre><code>OAUTH3.discover("<span ng-bind="vm.form.provider"></span>", opts);</code></pre>
|
||||||
<pre ng-if="vm.urls.discovery"><code><span ng-bind="vm.urls.discovery"></span></code></pre>
|
<pre ng-if="vm.urls.discovery"><code><span ng-bind="vm.urls.discovery"></span></code></pre>
|
||||||
|
|
||||||
<button ng-if="vm.directives" class="btn btn-default" ng-click="vm.fn.clearDirectives()">[X]</button>
|
<div ng-if="vm.directives">
|
||||||
<pre ng-if="vm.directives"><code><span ng-bind="vm.directives | json"></span></code></pre>
|
<button ng-if="vm.state.hideDirectives" class="btn btn-link" ng-click="vm.state.hideDirectives = !vm.state.hideDirectives">show directives</button>
|
||||||
|
<button ng-if="!vm.state.hideDirectives" class="btn btn-link" ng-click="vm.state.hideDirectives = !vm.state.hideDirectives">hide directives</button>
|
||||||
|
<pre ng-if="!vm.state.hideDirectives"><code><span ng-bind="vm.directives | json"></span></code></pre>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -215,7 +218,7 @@ ng-if="'none' === vm.framework || 'jquery' === vm.framework"></span><span ng-if=
|
||||||
(This is the URL of the iFrame that completes token refreshes. And it occurs over iFrame rather than API so that no server is required.)
|
(This is the URL of the iFrame that completes token refreshes. And it occurs over iFrame rather than API so that no server is required.)
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<button class="btn btn-default" ng-click="vm.api.refreshToken()" ng-disabled="!vm.directives || !vm.validated.provider">Open Logout Dialog</button>
|
<button class="btn btn-default" ng-click="vm.api.refreshToken()" ng-disabled="!vm.directives || !vm.validated.provider">Refresh Token</button>
|
||||||
|
|
||||||
<pre><code>OAUTH3.urls.refreshToken(directives, opts);</code></pre>
|
<pre><code>OAUTH3.urls.refreshToken(directives, opts);</code></pre>
|
||||||
<pre ng-if="vm.urls.refreshToken"><code><span ng-bind="vm.urls.refreshToken"></span></code></pre>
|
<pre ng-if="vm.urls.refreshToken"><code><span ng-bind="vm.urls.refreshToken"></span></code></pre>
|
||||||
|
@ -316,6 +319,34 @@ ng-if="'none' === vm.framework || 'jquery' === vm.framework"></span><span ng-if=
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row" ng-if="vm.validated.provider">
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<strong>Profile</strong>
|
||||||
|
<br>
|
||||||
|
(this is the profile object)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
|
||||||
|
<button class="btn btn-default" ng-click="vm.api.profile_get()" ng-disabled="!vm.accessToken">Get Profile</button>
|
||||||
|
|
||||||
|
<pre><code><span ng-bind="vm.urls.profile_get.method"></span> <span ng-bind="vm.urls.profile_get.url"></span>
|
||||||
|
<span ng-if="vm.urls.profile_get.headers" ng-bind="vm.urls.profile_get.headers | json"></span>
|
||||||
|
<span ng-bind="vm.urls.profile_get.data | json"></span>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre ng-if="!vm.responses.profile_get"><code> ...
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre ng-if="vm.responses.profile_get"><code><span ng-bind="vm.responses.profile_get.status"></span>
|
||||||
|
<span ng-if="vm.responses.profile_get.headers" ng-bind="vm.responses.profile_get.headers | json"></span>
|
||||||
|
<span ng-bind="vm.responses.profile_get.data | json"></span>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row" ng-if="vm.validated.provider">
|
<div class="row" ng-if="vm.validated.provider">
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
@ -346,7 +377,7 @@ ng-if="'none' === vm.framework || 'jquery' === vm.framework"></span><span ng-if=
|
||||||
<pre><code>OAUTH3.jwt.decode(token);</code></pre>
|
<pre><code>OAUTH3.jwt.decode(token);</code></pre>
|
||||||
|
|
||||||
<textarea class="form-control" ng-model="vm.accessToken" ng-change="vm.api.jwt.decode()"></textarea>
|
<textarea class="form-control" ng-model="vm.accessToken" ng-change="vm.api.jwt.decode()"></textarea>
|
||||||
<button class="btn btn-default" ng-click="vm.api.jwt.decode()" ng-disabled="!vm.refreshToken">Decode Access Token</button>
|
<button class="btn btn-default" ng-click="vm.api.jwt.decode()" ng-disabled="!vm.accessToken">Decode Access Token</button>
|
||||||
|
|
||||||
<textarea ng-if="vm.refreshToken" class="form-control" ng-model="vm.refreshToken" ng-change="vm.api.jwt.decodeRefresh()"></textarea>
|
<textarea ng-if="vm.refreshToken" class="form-control" ng-model="vm.refreshToken" ng-change="vm.api.jwt.decodeRefresh()"></textarea>
|
||||||
<button ng-if="vm.refreshToken" class="btn btn-default" ng-click="vm.api.jwt.decodeRefresh()" ng-disabled="!vm.refreshToken">Decode Refresh Token</button>
|
<button ng-if="vm.refreshToken" class="btn btn-default" ng-click="vm.api.jwt.decodeRefresh()" ng-disabled="!vm.refreshToken">Decode Refresh Token</button>
|
||||||
|
|
Loading…
Reference in New Issue