Created
February 9, 2018 22:13
-
-
Save bandrzejczak/10f0d19b408f1f16d41cec258de69d2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bootstrapAngular(keycloak, userInfo) { | |
angular.module('KeycloakApp') | |
.run(function ($rootScope) { | |
// store the token in header's defaults or a cookie - we'll cover that with the backend in part 2 | |
$rootScope.currentUser = { | |
username: userInfo.name || userInfo.preferred_username, | |
roles: keycloak.realmAccess.roles | |
}; | |
$rootScope.userLogout = function () { | |
keycloak.logout(); | |
}; | |
}); | |
angular.bootstrap(document, ['KeycloakApp']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment