public ProfileViewModel(ProfilePage profilePage) { this.Page = profilePage; if (Instance == null) { Instance = this; } ; this.StateManager = OktaContext.Current.StateManager; OktaContext.AddSignInCompletedListener(OnSignInCompleted); OktaContext.AddSignOutCompletedListener(OnSignOutCompleted); }
public void RaiseSignOutEventsOnSignOut() { OidcClient client = new OidcClient(new OktaConfig("testoktaid", "https://dev-00000.oktapreview.com", "com.test:/redirect", "com.test:/logout")); OktaContext.Init(client); bool?signOutStartedEventRaised = false; bool?signOutCompletedEventRaised = false; OktaContext.AddSignOutStartedListener((sender, eventArgs) => signOutStartedEventRaised = true); OktaContext.AddSignOutCompletedListener((sender, eventArgs) => signOutCompletedEventRaised = true); OktaContext.Current.SignIn(); client.CurrentTask_Accessor.SetResult(new OktaState("testAccessToken", "testTokenType", "testIdToken", "testRefreshToken")); OktaContext.Current.SignOut(); client.CurrentTask_Accessor.SetResult(new OktaState("", "")); Assert.True(signOutStartedEventRaised); Assert.True(signOutCompletedEventRaised); }