profile updates

This commit is contained in:
AJ ONeal 2017-11-17 06:15:53 +00:00
parent 980895992a
commit ece06b8463
4 changed files with 137 additions and 52 deletions

View File

@ -149,7 +149,15 @@
<p>A (mostly) client-side authentication and authorization framework for decentralized peer-to-peer and federated networks.
</div>
<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>
<h2>Private, Peer-to-Peer, Anonymous: Pick any two... at a time</h2>

View File

@ -94,6 +94,9 @@ $(function () {
// deprecated
'oauth3_authn': "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"
, 'bucket': "Access to file storage"
, 'db': "Access to app data"

View File

@ -34,11 +34,16 @@
vm.debouncing = {};
vm.defaults = { provider: vm.conf.provider_uri, directives: null };
vm.defaults.scopes = [
{ name: 'oauth3_authn', desc: "Basic secure authentication", checked: true }
{ name: 'profile@oauth3.org', desc: "Basic profile information", checked: true }
, { name: 'oauth3_authn', desc: "Basic secure authentication", checked: true }
//{ name: 'authn@oauth3.org', desc: "Basic secure authentication" }
, { name: 'photos@daplie.com', desc: "Access to photos" }
, { 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 = {};
@ -420,6 +425,44 @@
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._grantsOpts = function () {
return vm.api.authz._grantsOpts_ = {

View File

@ -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 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>
<pre ng-if="vm.directives"><code><span ng-bind="vm.directives | json"></span></code></pre>
<div ng-if="vm.directives">
<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>
@ -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.)
</div>
<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 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 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">
<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>
<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>
<button ng-if="vm.refreshToken" class="btn btn-default" ng-click="vm.api.jwt.decodeRefresh()" ng-disabled="!vm.refreshToken">Decode Refresh Token</button>