Skip to content
Snippets Groups Projects
Commit 596280ba authored by Alfredo Chissotti's avatar Alfredo Chissotti
Browse files

Non so perche', devo mandarlo dalla webapp

parent 8df9aba9
No related branches found
No related tags found
No related merge requests found
'use strict';
// import Keycloak from 'keycloak-js';
const Keycloak = require('keycloak-js');
// import Keycloak from './keycloak-js';
class Secured {
constructor() {
this.keycloak = null;
this.authenticated = false;
this.initKeycloak();
}
initKeycloak() {
const keycloak = new Keycloak('./keycloak.json');
keycloak.init({
onLoad: 'login-required' // login-required will authenticate the client if the user is logged-in to Keycloak or display the login page if not.
}).then(authenticated => {
this.keycloak = keycloak;
this.authenticated = authenticated;
});
const body = document.getElementById('body-id');
body.onload = function() {
const keycloak = new Keycloak('http://localhost:3000/keycloak.json');
keycloak.init({
onLoad: 'login-required' // login-required will authenticate the client if the user is logged-in to Keycloak or display the login page if not.
}).then(function(authenticated) {
this.keycloak = keycloak;
this.authenticated = authenticated;
});
}
}
async getUserInfo() {
......@@ -35,4 +33,4 @@ class Secured {
}
}
export default Secured;
\ No newline at end of file
export default Secured;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment