Exemplo n.º 1
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new T());
            bool result = base.FinishedLaunching(app, options);

            OktaContext.Init(new OidcClient(Window.RootViewController, OktaConfig.LoadFromPList("OktaConfig.plist")));

            return(result);
        }
Exemplo n.º 2
0
 public ProfileViewModel(ProfilePage profilePage)
 {
     this.Page = profilePage;
     if (Instance == null)
     {
         Instance = this;
     }
     ;
     this.StateManager = OktaContext.Current.StateManager;
     OktaContext.AddSignInCompletedListener(OnSignInCompleted);
     OktaContext.AddSignOutCompletedListener(OnSignOutCompleted);
 }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            OktaContext.Init(new OidcClient(this, OktaConfig.LoadFromXmlStream(Assets.Open("OktaConfig.xml"))));
            // TODO: change this to use .AddSignXXXCompletedListener methods.
            OktaContext.Current.SignInCompleted  += (sender, args) => Shell.Current.GoToAsync("//ProfilePage");
            OktaContext.Current.SignOutCompleted += (sender, args) => Shell.Current.GoToAsync("//ProfilePage");

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            global::Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new OktaApp());
        }
        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);
        }