angular-oauth2-oidc check session issue

117 views Asked by At

I'm using angular-oauth2-oidc and I want to use the check session in order to check if the current user is still logged on different apps

I'm using WSOIS as OP

I enabled the sessionChecksEnabled property

What I see is that the created hidden frame is something like this:

<iframe id="angular-oauth-oidc-check-session-iframe" src="https://localhost:9443/oidc/checksession" style="display: none;"></iframe>

So I'm not passing the client ID and redirect URI as WSO2 pretends. This doesn't allow to me to check the sessions.

So I modified the code by using this configuration:

this.oauthService.loadDiscoveryDocument("https://localhost:9443/oauth2/token/.well-known/openid-configuration?client_id=CMD9HhdTUnhP_02oUgnxwTPblgAa&redirect_uri=http://localhost:4200").then((evento)=>{
      this.oauthService.tryLogin().then(_ => {
        this.oauthService.events
        .pipe(filter(e => e.type === 'session_terminated'))
        .subscribe(() => {
          // tslint:disable-next-line:no-console
           console.debug('Sono portale 1 Your session has been terminated!');
        });
        if (useHash) {
          //Controllo se sono loggato o meno. Se sono loggato vado alla lista claims altrimenti 
          //Vado a home:
          if (this.oauthService.hasValidAccessToken() && this.oauthService.hasValidIdToken()) {
            console.log(this.oauthService.getAccessToken())
            this.isLogged = true;
            this.utenteLoggato = this.user();
            this.loggedUserSvc.userLogged(this.utenteLoggato);
            this.router.navigate(['parametri']);
          } else {
            this.isLogged = false;
            this.router.navigate(['home']);
          }
        }
      });
    });

Obviously login still works but I'm not able in checking sessions

Can anybody suggest me the best way to obtain my result? What I want is that the hidden frame is something like this:

<iframe id="angular-oauth-oidc-check-session-iframe" src="https://localhost:9443/oidc/checksession?client_id=CMD9HhdTUnhP_02oUgnxwTPblgAa&redirect_uri=http://localhost:4200" style="display: none;"></iframe>
0

There are 0 answers