I have a angularjs application which is deployed on app server and we have
a single sign on web server which on successful authentication redirects to
our application with the username in the response headers.
I have to read the username from the response headers when the angularjs
application loads and use it to show on my application.
*What i have tried:*
1.
Used as below in my app.js :
angular .module('myApp', [ 'ngResource', 'ngRoute', 'cgBusy',
'ui.bootstrap', 'ui.grid', 'ui.grid.pagination', 'ui.grid.moveColumns',
'ui.grid.selection', 'ui.grid.exporter', 'ngMaterial',
'angular-dropdown-multiselect' ]) .run(["$rootScope", function ($rootScope){
var checkIfAuthenticated = function (next) {
console.log('Inside checkIfAuthenticated ---> ' + next);
var matchedData = next.match( /[\?\&]username=([^\&]+)/);
console.log('Inside checkIfAuthenticated matchedData ---> ' +
matchedData);
var proxyUserMatch = next.match( /[\?\&]username=([^\&]+)/);
console.log('Inside checkIfAuthenticated proxyUserMatch ---> ' +
proxyUserMatch)
};
var firstTimeRoute = $rootScope.$on("$locationChangeStart",
function(event, next, current) {
console.log( "route change (first time)->current=[" + current + "],
next=[" + next + "]");
checkIfAuthenticated( next);
firstTimeRoute(); // opt out of the event
});}]);
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.