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
[ { | |
"id" : "cc4057d1-0d5a-4bba-9cd2-99a78907f3b8", | |
"realm" : "unika", | |
"notBefore" : 0, | |
"accessTokenLifespan" : 300, | |
"ssoSessionIdleTimeout" : 1800, | |
"ssoSessionMaxLifespan" : 36000, | |
"accessCodeLifespan" : 60, | |
"accessCodeLifespanUserAction" : 300, | |
"accessCodeLifespanLogin" : 1800, |
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() { | |
var app = angular.module('myApp', ['ngRoute']); | |
app.controller('PageController', function($scope, $http, $timeout ,keycloakLauncher) { | |
$scope.loggedIn = keycloakLauncher.loggedIn; | |
$scope.user = function(){ | |
console.log("User keycloak ", keycloakLauncher.keycloak); | |
console.log("User loggedin ", keycloakLauncher.loggedIn); |
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
<!doctype html> | |
<html lang="en" ng-app="myApp"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Angular Product Portal</title> | |
<script src="bower_components/angular/angular.js"></script> | |
<script src="bower_components/angular-resource/angular-resource.min.js"></script> | |
<script src="bower_components/angular-route/angular-route.min.js"></script> |
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() { | |
var app = angular.module('myApp', []); | |
app.controller('PageController', function($rootScope,$scope, $http ,keycloakLauncher) { | |
$scope.loggedIn = keycloakLauncher.loggedIn; | |
$scope.user = function(){ | |
console.log("keycloak ", keycloakLauncher.keycloak); | |
console.log("loggedin ", keycloakLauncher.loggedIn); |
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() { | |
var app = angular.module('myApp', []); | |
app.provider('keycloakLauncher', function keycloakLauncherProvider() { | |
this.keycloak = {}; | |
this.loggedIn = false; | |
this.logoutUrl = ""; | |
this.$get = function () { | |
var keycloak = this.keycloak; |
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
keycloakAuth.init().success(function(authenticated) { | |
if(authenticated ){ | |
auth.loggedIn = true; | |
auth.authz = keycloakAuth; | |
}else{ | |
auth.loggedIn = false; | |
} | |
console.log('Init Autenticado ' +auth.loggedIn ); | |
}).error(function() { | |
console.log('failed to initialize'); |
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
import java.io.File; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.RandomAccessFile; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.Date; | |
import javax.ejb.EJB; | |
import javax.servlet.ServletException; |
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
@GET | |
@Produces("application/json") | |
@NoCache | |
public List<UsuarioJS> getUsuarios(@QueryParam("min") String min, | |
@QueryParam("results") String results) { | |
// Just to show how to user info from access token in REST endpoint | |
KeycloakSecurityContext securityContext = (KeycloakSecurityContext) httpRequest | |
.getAttribute(KeycloakSecurityContext.class.getName()); | |
AccessToken accessToken = securityContext.getToken(); |
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
app.factory('authInterceptor', function($q, Auth) { | |
return { | |
request: function (config) { | |
var deferred = $q.defer(); | |
if (Auth.authz.token) { | |
console.log("entro") | |
Auth.authz.updateToken(5).success(function() { | |
config.headers = config.headers || {}; |