public override void ApplyToOwinSecurityOptions(AuthenticationOptions options)
        {
            base.ApplyToOwinSecurityOptions(options);

            var opts = options as JetPassAuthenticationOptions;
            if (opts != null)
            {
                if (String.IsNullOrEmpty(ClientId))
                {
                    throw new ConfigurationErrorsException(String.Format(
                        CultureInfo.CurrentCulture,
                        Strings.MissingRequiredConfigurationValue,
                        "Auth.JetPass.ClientId"));
                }

                opts.ClientId = ClientId;
                opts.Scope = new []{ ClientId };

                if (String.IsNullOrEmpty(ClientSecret))
                {
                    throw new ConfigurationErrorsException(String.Format(
                        CultureInfo.CurrentCulture,
                        Strings.MissingRequiredConfigurationValue,
                        "Auth.JetPass.ClientSecret"));
                }

                opts.ClientSecret = ClientSecret;

                if (!String.IsNullOrEmpty(RootUri))
                {
                  opts.Endpoints = new JetPassAuthenticationOptions.JetPassAuthenticationEndpoints(new Uri(RootUri));
                }
            }
        }
 public virtual void ApplyToOwinSecurityOptions(AuthenticationOptions options)
 {
     if (!String.IsNullOrEmpty(AuthenticationType))
     {
         options.AuthenticationType = AuthenticationType;
     }
 }
        public override void ApplyToOwinSecurityOptions(AuthenticationOptions options)
        {
            base.ApplyToOwinSecurityOptions(options);

            var opts = options as MicrosoftAccountAuthenticationOptions;
            if (opts != null)
            {
                if (String.IsNullOrEmpty(ClientId))
                {
                    throw new ConfigurationErrorsException(String.Format(
                        CultureInfo.CurrentCulture,
                        Strings.MissingRequiredConfigurationValue,
                        "Auth.MicrosoftAccount.ClientId"));
                }

                opts.ClientId = ClientId;

                if (String.IsNullOrEmpty(ClientSecret))
                {
                    throw new ConfigurationErrorsException(String.Format(
                        CultureInfo.CurrentCulture,
                        Strings.MissingRequiredConfigurationValue,
                        "Auth.MicrosoftAccount.ClientSecret"));
                }

                opts.ClientSecret = ClientSecret;
            }
        }
        public override void ApplyToOwinSecurityOptions(AuthenticationOptions options)
        {
            base.ApplyToOwinSecurityOptions(options);

            var opts = options as OpenIdConnectAuthenticationOptions;
            if (opts != null)
            {
                // Set passive so that a HTTP 401 does not automatically trigger
                // Azure AD authentication. NuGet uses an explicit challenge to trigger
                // the auth flow.
                opts.AuthenticationMode = AuthenticationMode.Passive;

                // Make sure ClientId is configured
                if (String.IsNullOrEmpty(ClientId))
                {
                    throw new ConfigurationErrorsException(String.Format(
                        CultureInfo.CurrentCulture,
                        Strings.MissingRequiredConfigurationValue,
                        "Auth.AzureActiveDirectory.ClientId"));
                }

                opts.ClientId = ClientId;

                // Make sure Authority is configured
                if (String.IsNullOrEmpty(Authority))
                {
                    throw new ConfigurationErrorsException(String.Format(
                        CultureInfo.CurrentCulture,
                        Strings.MissingRequiredConfigurationValue,
                        "Auth.AzureActiveDirectory.Authority"));
                }

                opts.Authority = Authority;

                // Make sure Issuer is configured
                if (String.IsNullOrEmpty(Issuer))
                {
                    throw new ConfigurationErrorsException(String.Format(
                        CultureInfo.CurrentCulture,
                        Strings.MissingRequiredConfigurationValue,
                        "Auth.AzureActiveDirectory.Issuer"));
                }
            }
        }
        private void Initialize(
            string credentialsProfileName,
            IAmazonWebServicesIdentityAnchoringBehavior anchoringBehavior,
            AuthenticationOptions authenticationOptions)
        {
            if (string.IsNullOrWhiteSpace(credentialsProfileName))
            {
                throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameCredentialsProfileName);
            }

            if (null == anchoringBehavior)
            {
                throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameAnchoringBehavior);
            }

            if (null == authenticationOptions)
            {
                throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameAuthenticationOptions);
            }

            this.credentials = new StoredProfileAWSCredentials(credentialsProfileName);

            this.anchoringBehaviorValue = anchoringBehavior;
            
            this.windowsAzureActiveDirectoryBearerAuthenticationOptions = 
                authenticationOptions as WindowsAzureActiveDirectoryBearerAuthenticationOptions;
            if (this.windowsAzureActiveDirectoryBearerAuthenticationOptions != null)
            {
                this.windowsAzureActiveDirectoryBearerAuthenticationOptions.TokenHandler = new TokenHandler();
            }
        }