OneIdentity / IdentityManager.Imx

HTML5 source code for Identity Manager web apps
Other
26 stars 107 forks source link

v92: SessionState and oAuth (session-state.ts) #130

Open juancarloscamargo opened 3 months ago

juancarloscamargo commented 3 months ago

Hi,

Is sessionstate (ISessionState.isOAuth) oAuth status being populated? I'm getting a value of undefined everytime I check it , even with I'm logged in with that auth method. It seems there is no handling of that value within the class:

(...)

export class SessionState implements ISessionState {

public get IsLoggedOut(): boolean { return this.currentAuthStep === AuthStepLevels.LoggedOut; } public get IsAwaitingSecondaryAuth(): boolean { return this.currentAuthStep === AuthStepLevels.AwaitsSecondaryAuth; } public get IsLoggedIn(): boolean { return this.currentAuthStep === AuthStepLevels.LoggedIn; } public get Username(): string { return this.sessionResponse && this.IsLoggedIn ? this.sessionResponse.Status.PrimaryAuth.Display : null; } public get UserUid(): string { return this.sessionResponse && this.IsLoggedIn ? this.sessionResponse.Status.PrimaryAuth.Uid : null; } public get SecondaryAuthName(): string { return this.sessionResponse && this.sessionResponse.Status && this.sessionResponse.Status.SecondaryAuth ? this.sessionResponse.Status.SecondaryAuth.Name : null; }

(...)

Mathnstein commented 3 months ago

Hi @juancarloscamargo - coming from the developer who worked on this feature:

The sessionstate represents the session regardless of how the user authenticated, including OAuth-based flows. Our components rely on the session state to detect if the user is logged in, and you should be seeing the same state.

juancarloscamargo commented 3 months ago

Hi @Mathnstein ,

I was trying to figure out how the user authenticated and apply some actions accordingly. That's why I was working with the SessionState class, which implements ISessionState , this one having the following definition:

export interface ISessionState { IsLoggedOut?: boolean; IsAwaitingSecondaryAuth?: boolean; IsLoggedIn?: boolean; Username?: string; UserUid?: string; SecondaryAuthName?: string; SecondaryErrorMessage?: string; configurationProviders?: AuthConfigProvider[]; externalLogoutUrl?: string; isOAuth?: boolean; hasErrorState?: boolean; culture?: string; cultureFormat?: string; }

, but found that the isOauth value is not being populated. Thanks!