Beispiel #1
0
        public OthersContentPage()
        {
            InitializeComponent();
            if (XamarinDevice.RuntimePlatform == XamarinDevice.iOS)
            {
                Icon = "handbag.png";
            }

            // Setup auth type dropdown choices
            foreach (var authType in AuthTypeUtils.GetAuthTypeChoiceStrings())
            {
                this.AuthTypePicker.Items.Add(authType);
            }
            this.AuthTypePicker.SelectedIndex = (int)(AuthTypeUtils.GetPersistedAuthType());
        }
Beispiel #2
0
        static IReadOnlyDictionary <string, string> GetAppSecretDictionary()
        {
            // If user has selected another Auth Type, override the secret dictionary accordingly.
            var persistedAuthType = AuthTypeUtils.GetPersistedAuthType();

            switch (persistedAuthType)
            {
            case AuthType.AAD:
                return(AADAuthAppSecrets);

            case AuthType.B2C:
            default:
                return(B2CAuthAppSecrets);
            }
        }
Beispiel #3
0
 async void ChangeAuthType(object sender, PropertyChangedEventArgs e)
 {
     // IOS sends an event every time user rests their selection on an item without hitting "done", and the only event they send when hitting "done" is that the control is no longer focused.
     // So we'll process the change at that time. This works for android as well.
     if (e.PropertyName == "IsFocused" && !this.AuthTypePicker.IsFocused)
     {
         var newSelectionCandidate = this.AuthTypePicker.SelectedIndex;
         var persistedAuthType     = AuthTypeUtils.GetPersistedAuthType();
         if (newSelectionCandidate != (int)persistedAuthType)
         {
             AuthTypeUtils.SetPersistedAuthType((AuthType)newSelectionCandidate);
             await Application.Current.SavePropertiesAsync();
             await DisplayAlert("Authorization Type Changed", "Authorization type has changed, which alters the app secret. Please close and re-run the app for the new app secret to take effect.", "OK");
         }
     }
 }