public AcquireTokenInteractiveParameterBuilder WithProofOfPossession(string nonce, HttpMethod httpMethod, Uri requestUri) { ValidateUseOfExperimentalFeature(); ClientApplicationBase.GuardMobileFrameworks(); if (!ServiceBundle.Config.IsBrokerEnabled) { throw new MsalClientException(MsalError.BrokerRequiredForPop, MsalErrorMessage.BrokerRequiredForPop); } var broker = ServiceBundle.PlatformProxy.CreateBroker(ServiceBundle.Config, null); if (!broker.IsPopSupported) { throw new MsalClientException(MsalError.BrokerDoesNotSupportPop, MsalErrorMessage.BrokerDoesNotSupportPop); } PoPAuthenticationConfiguration popConfig = new PoPAuthenticationConfiguration(requestUri); if (string.IsNullOrEmpty(nonce)) { throw new ArgumentNullException(nameof(nonce)); } popConfig.Nonce = nonce; popConfig.HttpMethod = httpMethod; CommonParameters.PopAuthenticationConfiguration = popConfig; CommonParameters.AuthenticationScheme = new PopBrokerAuthenticationScheme(); return(this); }
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] // hide confidential client on mobile #endif public static ConfidentialClientApplicationBuilder Create(string clientId) { ClientApplicationBase.GuardMobileFrameworks(); var config = new ApplicationConfiguration(); return(new ConfidentialClientApplicationBuilder(config) .WithClientId(clientId) .WithCacheSynchronization(false)); }
internal static AcquireTokenByAuthorizationCodeParameterBuilder Create( IConfidentialClientApplicationExecutor confidentialClientApplicationExecutor, IEnumerable <string> scopes, string authorizationCode) { ClientApplicationBase.GuardMobileFrameworks(); return(new AcquireTokenByAuthorizationCodeParameterBuilder(confidentialClientApplicationExecutor) .WithScopes(scopes).WithAuthorizationCode(authorizationCode)); }
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] // hide confidential client on mobile #endif public AcquireTokenSilentParameterBuilder WithProofOfPossession(PoPAuthenticationConfiguration popAuthenticationConfiguration) { ClientApplicationBase.GuardMobileFrameworks(); ValidateUseOfExperimentalFeature(); CommonParameters.PopAuthenticationConfiguration = popAuthenticationConfiguration ?? throw new ArgumentNullException(nameof(popAuthenticationConfiguration)); CommonParameters.AuthenticationScheme = new PopAuthenticationScheme(CommonParameters.PopAuthenticationConfiguration, ServiceBundle); return(this); }
public AcquireTokenSilentParameterBuilder WithProofOfPossession(string nonce, HttpMethod httpMethod, Uri requestUri) { ValidateUseOfExperimentalFeature(); ClientApplicationBase.GuardMobileFrameworks(); var broker = ServiceBundle.PlatformProxy.CreateBroker(ServiceBundle.Config, null); if (ServiceBundle.Config.IsBrokerEnabled) { if (string.IsNullOrEmpty(nonce)) { throw new ArgumentNullException(nameof(nonce)); } if (!broker.IsPopSupported) { throw new MsalClientException(MsalError.BrokerDoesNotSupportPop, MsalErrorMessage.BrokerDoesNotSupportPop); } } PoPAuthenticationConfiguration popConfig = new PoPAuthenticationConfiguration(requestUri ?? throw new ArgumentNullException(nameof(requestUri))); popConfig.HttpMethod = httpMethod ?? throw new ArgumentNullException(nameof(httpMethod)); popConfig.Nonce = nonce; IAuthenticationScheme authenticationScheme; //POP Auth scheme should not wrap and sign token when broker is enabled for public clients if (ServiceBundle.Config.IsBrokerEnabled) { popConfig.SignHttpRequest = false; authenticationScheme = new PopBrokerAuthenticationScheme(); } else { authenticationScheme = new PopAuthenticationScheme(popConfig, ServiceBundle); } CommonParameters.PopAuthenticationConfiguration = popConfig; CommonParameters.AuthenticationScheme = authenticationScheme; return(this); }
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] // hide confidential client on mobile #endif public static ConfidentialClientApplicationBuilder CreateWithApplicationOptions( ConfidentialClientApplicationOptions options) { ClientApplicationBase.GuardMobileFrameworks(); var config = new ApplicationConfiguration(); var builder = new ConfidentialClientApplicationBuilder(config).WithOptions(options); if (!string.IsNullOrWhiteSpace(options.ClientSecret)) { builder = builder.WithClientSecret(options.ClientSecret); } if (!string.IsNullOrWhiteSpace(options.AzureRegion)) { builder = builder.WithAzureRegion(options.AzureRegion); } builder = builder.WithCacheSynchronization(options.EnableCacheSynchronization); return(builder); }
/// <inheritdoc /> internal ConfidentialClientApplicationBuilder(ApplicationConfiguration configuration) : base(configuration) { ClientApplicationBase.GuardMobileFrameworks(); }
internal AcquireTokenByAuthorizationCodeParameterBuilder(IConfidentialClientApplicationExecutor confidentialClientApplicationExecutor) : base(confidentialClientApplicationExecutor) { ClientApplicationBase.GuardMobileFrameworks(); }
/// <inheritdoc /> public override Task <AuthenticationResult> ExecuteAsync(CancellationToken cancellationToken) { ClientApplicationBase.GuardMobileFrameworks(); ValidateAndCalculateApiId(); return(ExecuteInternalAsync(cancellationToken)); }
internal AbstractConfidentialClientAcquireTokenParameterBuilder(IConfidentialClientApplicationExecutor confidentialClientApplicationExecutor) : base(confidentialClientApplicationExecutor.ServiceBundle) { ClientApplicationBase.GuardMobileFrameworks(); ConfidentialClientApplicationExecutor = confidentialClientApplicationExecutor; }