Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions dist/angularJsOAuth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@
'client_id=' + encodeURIComponent(service.clientId) + '&' +
'redirect_uri=' + encodeURIComponent(performSilently?service.silentTokenRedirectUrl:service.redirectUrl) + '&' +
'response_type=' + encodeURIComponent(service.responseType) + '&' +
'scope=' + encodeURIComponent(service.scope);
'scope=' + encodeURIComponent(service.scope) + '&' +
'aud=' + encodeURIComponent(service.aud);
if (service.nonce) {
url += '&nonce=' + encodeURIComponent(service.nonce);
}
Expand Down Expand Up @@ -294,6 +295,7 @@
service.silentTokenRedirectUrl= params.silentTokenRedirectUrl;
service.signOutRedirectUrl = params.signOutRedirectUrl;
service.state = params.state || generateState();
service.aud = params.aud;
if (params.signOutAppendToken == 'true') {
service.appendSignoutToken = true;
}
Expand All @@ -304,11 +306,17 @@

// Open ID directive
angular.module('oauth2.directive', [])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/silent-renew', {
.config(['$injector', function($injector){
if ($injector.has('$routeProvider')){
// If $routeProvider has been registered then allow silent renew
console.log('Has $routeProvider: Allowing for silent renew');
$injector.get('$routeProvider').when('/silent-renew', {
template: ""
})
});
} else {
// Otherwise don't do anything.
console.log('Skipping $routeProvider');
}
}])
.directive('oauth2', ['$rootScope', '$http', '$window', '$location', '$templateCache', '$compile', 'AccessToken', 'Endpoint', function($rootScope, $http, $window, $location, $templateCache, $compile, accessToken, endpoint) {
var definition = {
Expand All @@ -331,18 +339,19 @@
silentTokenRedirectUrl: '@', // url to use for silently renewing access tokens, default behaviour is not to do
nonce: '@?', // nonce value, optional. If unspecified or an empty string and autoGenerateNonce is true then a nonce will be auto-generated
autoGenerateNonce: '=?', // Should a nonce be autogenerated if not supplied. Optional and defaults to true.
tokenStorageHandler: '='
tokenStorageHandler: '=',
aud: '@?'
}
};

definition.link = function(scope, element, attrs) {
function compile() {
var tpl = '<p class="navbar-btn"><a class="{{buttonClass}}" ng-click="signedIn ? signOut() : signIn()"><span href="#" ng-hide="signedIn">{{signInText}}</span><span href="#" ng-show="signedIn">{{signOutText}}</span></a></p>';
if (scope.template) {
$http.get(scope.template, { cache: $templateCache }).then(function(templateResult) {
element.html(templateResult.data);
$compile(element.contents())(scope);
});
$http.get(scope.template, { cache: $templateCache }).success(function(html) {
element.html(html);
$compile(element.contents())(scope);
});
} else {
element.html(tpl);
$compile(element.contents())(scope);
Expand Down Expand Up @@ -372,6 +381,7 @@
scope.signOutRedirectUrl = scope.signOutRedirectUrl || '';
scope.unauthorizedAccessUrl = scope.unauthorizedAccessUrl || '';
scope.silentTokenRedirectUrl = scope.silentTokenRedirectUrl || '';
scope.aud = scope.aud || '';
if (scope.autoGenerateNonce === undefined) {
scope.autoGenerateNonce = true;
}
Expand Down