mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
First attempt at DECC Integration
This commit is contained in:
1 parent
f5d41c645c
commit
c9e0f573ee
9 files changed
+458
-9
No files matched your search
@@ -0,0 +1,43 @@
|
||||
<!-- <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline' 'unsafe-eval' https://a69adcd0687194b2b8adebdbe93f2a02-977850409.eu-west-2.elb.amazonaws.com/auth/js/keycloak.js;"> -->
|
||||
|
||||
<script src="https://a69adcd0687194b2b8adebdbe93f2a02-977850409.eu-west-2.elb.amazonaws.com/auth/js/keycloak.js"></script>
|
||||
<script>
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
var keycloak = new Keycloak({
|
||||
url: 'https://a69adcd0687194b2b8adebdbe93f2a02-977850409.eu-west-2.elb.amazonaws.com/auth',
|
||||
realm: 'iam',
|
||||
clientId: 'kaas'
|
||||
});
|
||||
|
||||
//if param "logout" was passed to this page, logout user!
|
||||
const logoutUser = new URL(location.href).searchParams.get('logout');
|
||||
if(logoutUser){
|
||||
keycloak.init();
|
||||
keycloak.logout({redirectUri: 'http://localhost:3000'});
|
||||
}else{
|
||||
keycloak.init({ flow: 'standard', enableLogging: true, useNonce: false, onLoad: 'login-required', checkLoginIframe: false, redirectUri: 'http://localhost:3000'}).success(function(authenticated) {
|
||||
console.log('success!!');
|
||||
if (authenticated) {
|
||||
console.log("keycloak.token: " + keycloak.token);
|
||||
console.log("keycloak.idToken: " + keycloak.idToken);
|
||||
console.log("keycloak.refreshToken: " + keycloak.refreshToken);
|
||||
|
||||
console.log("keycloak object: "+ JSON.stringify(keycloak));
|
||||
ipcRenderer.send('keycloak-token', keycloak.idToken, keycloak.refreshToken);
|
||||
|
||||
//TODO: check if token refresh is possible here
|
||||
/*
|
||||
setInterval(() => {
|
||||
console.log("interval");
|
||||
keycloak.updateToken(10).error(() => keycloak.logout());
|
||||
console.log(keycloak.token);
|
||||
ipcRenderer.send('keycloak-token-update', keycloak.token);
|
||||
}, 10000);
|
||||
*/
|
||||
}
|
||||
}).error(function(error) {
|
||||
console.log('error: ' + JSON.stringify(error));
|
||||
});
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user