Example #1
0
 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 RaiseSignInEventsOnSignIn()
        {
            OidcClient client = new OidcClient(new OktaConfig("testoktaid", "https://dev-00000.oktapreview.com", "com.test:/redirect", "com.test:/logout"));

            OktaContext.Init(client);
            bool?signInStartedEventRaised   = false;
            bool?signInCompletedEventRaised = false;

            OktaContext.AddSignInStartedListener((sender, eventArgs) => signInStartedEventRaised     = true);
            OktaContext.AddSignInCompletedListener((sender, eventArgs) => signInCompletedEventRaised = true);

            OktaContext.Current.SignIn();
            client.CurrentTask_Accessor.SetResult(new OktaState("testAccessToken", "testTokenType", "testIdToken", "testRefreshToken"));

            Assert.True(signInStartedEventRaised);
            Assert.True(signInCompletedEventRaised);
        }