update docs and ng api
This commit is contained in:
parent
ee631b97c7
commit
52675f84c7
16
README.md
16
README.md
|
@ -286,6 +286,18 @@ We've created an `Oauth3` service just for you:
|
||||||
<script src="assets/org.oauth3/oauth3.ng.js"></script>
|
<script src="assets/org.oauth3/oauth3.ng.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Require the module as 'oauth3.org'
|
||||||
|
var app = angular.module('myAppName', [ 'ui.router', 'oauth3.org' ]);
|
||||||
|
|
||||||
|
// Require services and other submodules in the form {modulename}@oauth3.org
|
||||||
|
app.controller('authCtrl', [ '$scope', 'azp@oauth3.org', function ($scope, Oauth3) { /* ... */ } ]);
|
||||||
|
|
||||||
|
// For backwards compatibility with older angular applications that rely on string-name introspection
|
||||||
|
// you can also use the camel case version of the names in the format {Modulename}Oauth3
|
||||||
|
app.controller('authCtrl', function ($scope, AzpOauth3) { /* ... */ });
|
||||||
|
```
|
||||||
|
|
||||||
You can include that in addition to the standard file or,
|
You can include that in addition to the standard file or,
|
||||||
if you don't want an extra request, just paste it into your `app.js`.
|
if you don't want an extra request, just paste it into your `app.js`.
|
||||||
|
|
||||||
|
@ -300,8 +312,8 @@ oauth3 = OAUTH3.create(location); // takes a location object,
|
||||||
// to create the Client URI (your app's id)
|
// to create the Client URI (your app's id)
|
||||||
// and save it to an internal state
|
// and save it to an internal state
|
||||||
|
|
||||||
promise = oauth3.init(location); // set and fetch your own site/app's configuration details
|
promise = oauth3.init(opts); // set and fetch your own site/app's configuration details
|
||||||
// promises your site's config
|
// promises your site's config // opts = { location, session, issuer, audience }
|
||||||
|
|
||||||
promise = oauth3.setIdentityProvider(url); // changes the Identity Provider URI (the site you're logging into),
|
promise = oauth3.setIdentityProvider(url); // changes the Identity Provider URI (the site you're logging into),
|
||||||
// promises the provider's config // gets the config for that site (from their .well-known/oauth3),
|
// promises the provider's config // gets the config for that site (from their .well-known/oauth3),
|
||||||
|
|
|
@ -1097,7 +1097,16 @@
|
||||||
//, _resourceProviderMap: null // map between xyz.com and org.oauth3.domains
|
//, _resourceProviderMap: null // map between xyz.com and org.oauth3.domains
|
||||||
, _init: function (location, opts) {
|
, _init: function (location, opts) {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (location) {
|
if (!opts) {
|
||||||
|
opts = location;
|
||||||
|
}
|
||||||
|
if (location && location.location) {
|
||||||
|
location = location.location;
|
||||||
|
}
|
||||||
|
if (opts && opts.location) {
|
||||||
|
me._clientUri = OAUTH3.clientUri(opts.location);
|
||||||
|
}
|
||||||
|
if (location && (location.host || location.hostname)) {
|
||||||
me._clientUri = OAUTH3.clientUri(location);
|
me._clientUri = OAUTH3.clientUri(location);
|
||||||
}
|
}
|
||||||
if (opts) {
|
if (opts) {
|
||||||
|
@ -1105,11 +1114,11 @@
|
||||||
me._identityProviderUri = opts.providerUri;
|
me._identityProviderUri = opts.providerUri;
|
||||||
me._resourceProviderUri = opts.providerUri;
|
me._resourceProviderUri = opts.providerUri;
|
||||||
}
|
}
|
||||||
if (opts.identityProviderUri) {
|
if (opts.issuer || opts.identityProviderUri) {
|
||||||
me._identityProviderUri = opts.identityProviderUri;
|
me._identityProviderUri = opts.issuer || opts.identityProviderUri;
|
||||||
}
|
}
|
||||||
if (opts.resourceProviderUri) {
|
if (opts.audience || opts.resourceProviderUri) {
|
||||||
me._resourceProviderUri = opts.resourceProviderUri;
|
me._resourceProviderUri = opts.audience || opts.resourceProviderUri;
|
||||||
}
|
}
|
||||||
if (opts.session) {
|
if (opts.session) {
|
||||||
if (!me._identityProviderUri) {
|
if (!me._identityProviderUri) {
|
||||||
|
|
14
oauth3.ng.js
14
oauth3.ng.js
|
@ -1,9 +1,8 @@
|
||||||
;(function () {
|
;(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular
|
var modules = {
|
||||||
.module('org.oauth3', [])
|
azp: [
|
||||||
.service('Oauth3', [
|
|
||||||
'$timeout'
|
'$timeout'
|
||||||
, '$q'
|
, '$q'
|
||||||
, function Oauth3($timeout, $q) {
|
, function Oauth3($timeout, $q) {
|
||||||
|
@ -34,5 +33,12 @@ angular
|
||||||
window.ngOauth3 = OAUTH3;
|
window.ngOauth3 = OAUTH3;
|
||||||
|
|
||||||
return OAUTH3;
|
return OAUTH3;
|
||||||
}]);
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('oauth3.org', [])
|
||||||
|
.service('azp@oauth3.org', modules.azp);
|
||||||
|
.service('AzpOauth3', modules.azp);
|
||||||
}());
|
}());
|
||||||
|
|
Loading…
Reference in New Issue