public IWebUI CreateAuthenticationDialog(UIParent parent, RequestContext requestContext) { return(new WebUI(parent) { RequestContext = requestContext }); }
private async Task <AuthenticationResult> AcquireTokenForLoginHintCommonAsync( Authority authority, IEnumerable <string> scopes, IEnumerable <string> extraScopesToConsent, string loginHint, UIBehavior behavior, string extraQueryParameters, UIParent parent, ApiEvent.ApiIds apiId) { var requestParams = CreateRequestParameters(authority, scopes, null, UserTokenCache); requestParams.ExtraQueryParameters = extraQueryParameters; var handler = new InteractiveRequest( ServiceBundle, requestParams, apiId, extraScopesToConsent, loginHint, behavior, CreateWebAuthenticationDialog( parent, behavior, requestParams.RequestContext)); return(await handler.RunAsync(CancellationToken.None).ConfigureAwait(false)); }
public IWebUI CreateAuthenticationDialog(UIParent parent, RequestContext requestContext) { //there is no need to pass UIParent. return(new WebUI() { RequestContext = requestContext }); }
/// <summary> /// Interactive request to acquire token. /// </summary> /// <param name="scopes">Array of scopes requested for resource</param> /// <param name="user">User object to enforce the same user to be authenticated in the web UI.</param> /// <param name="parent">Object contains reference to parent window/activity. REQUIRED for Xamarin.Android only.</param> /// <returns>Authentication result containing token of the user</returns> public async Task <AuthenticationResult> AcquireTokenAsync( IEnumerable <string> scopes, IUser user, UIParent parent) { Authority authority = Internal.Instance.Authority.CreateAuthority(Authority, ValidateAuthority); return (await AcquireTokenForUserCommonAsync(authority, scopes, null, user, UIBehavior.SelectAccount, null, parent, ApiEvent.ApiIds.AcquireTokenWithScopeUser).ConfigureAwait(false)); }
/// <summary> /// Interactive request to acquire token for the specified scopes. The user will need to sign-in but an account will be proposed /// based on the provided <paramref name="account"/> /// </summary> /// <param name="scopes">Scopes requested to access a protected API</param> /// <param name="account">Account to use for the interactive token acquisition. See <see cref="IAccount"/> for ways to get an account</param> /// <param name="parent">Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.</param> /// <returns>Authentication result containing a token for the requested scopes and account</returns> public async Task <AuthenticationResult> AcquireTokenAsync( IEnumerable <string> scopes, IAccount account, UIParent parent) { GuardNetCore(); Authority authority = Instance.Authority.CreateAuthority(ServiceBundle, Authority, ValidateAuthority); return (await AcquireTokenForUserCommonAsync(authority, scopes, null, account, UIBehavior.SelectAccount, null, parent, ApiEvent.ApiIds.AcquireTokenWithScopeUser).ConfigureAwait(false)); }
public IWebUI CreateAuthenticationDialog(UIParent parent, RequestContext requestContext) { if (parent.UseHiddenBrowser) { return(new SilentWebUI { OwnerWindow = parent?.OwnerWindow, RequestContext = requestContext }); } return(new InteractiveWebUI { OwnerWindow = parent?.OwnerWindow, RequestContext = requestContext }); }
internal IWebUI CreateWebAuthenticationDialog(UIParent parent, UIBehavior behavior, RequestContext requestContext) { //create instance of UIParent and assign useCorporateNetwork to UIParent if (parent == null) { parent = new UIParent(); } #if WINRT || DESKTOP //hidden webview can be used in both WinRT and desktop applications. parent.UseHiddenBrowser = behavior.Equals(UIBehavior.Never); #if WINRT parent.UseCorporateNetwork = UseCorporateNetwork; #endif #endif return(PlatformPlugin.WebUIFactory.CreateAuthenticationDialog(parent, requestContext)); }
internal IWebUI CreateWebAuthenticationDialog(UIParent parent, UIBehavior behavior, RequestContext requestContext) { //create instance of UIParent and assign useCorporateNetwork to UIParent if (parent == null) { #pragma warning disable CS0618 // Throws a good exception on Android, but ctor cannot be removed for backwards compat reasons parent = new UIParent(); #pragma warning restore CS0618 // Type or member is obsolete } #if WINDOWS_APP || DESKTOP //hidden webview can be used in both WinRT and desktop applications. parent.UseHiddenBrowser = behavior.Equals(UIBehavior.Never); #if WINDOWS_APP parent.UseCorporateNetwork = UseCorporateNetwork; #endif #endif return(ServiceBundle.PlatformProxy.GetWebUiFactory().CreateAuthenticationDialog(parent.CoreUIParent, requestContext)); }
public WebUI(UIParent parent) { _parent = parent; }
/// <summary> /// Interactive request to acquire token for a given account, with the possibility of controlling the user experience, passing extra query /// parameters, providing extra scopes that the user can pre-consent to, and overriding the authority pre-configured in the application /// </summary> /// <param name="scopes">Scopes requested to access a protected API</param> /// <param name="account">Account to use for the interactive token acquisition. See <see cref="IAccount"/> for ways to get an account</param> /// <param name="behavior">Designed interactive experience for the user.</param> /// <param name="extraQueryParameters">This parameter will be appended as is to the query string in the HTTP authentication request to the authority. /// This is expected to be a string of segments of the form <c>key=value</c> separated by an ampersand character. /// The parameter can be null.</param> /// <param name="extraScopesToConsent">scopes that you can request the end user to consent upfront, in addition to the scopes for the protected Web API /// for which you want to acquire a security token.</param> /// <param name="authority">Specific authority for which the token is requested. Passing a different value than configured does not change the configured value</param> /// <param name="parent">Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.</param> /// <returns>Authentication result containing a token for the requested scopes and account</returns> public Task<AuthenticationResult> AcquireTokenAsync(IEnumerable<string> scopes, IAccount account, UIBehavior behavior, string extraQueryParameters, IEnumerable<string> extraScopesToConsent, string authority, UIParent parent) { throw new NotImplementedException(); }
/// <summary> /// Interactive request to acquire token for a login with control of the UI behavior and possiblity of passing extra query parameters like additional claims /// </summary> /// <param name="scopes">Scopes requested to access a protected API</param> /// <param name="loginHint">Identifier of the user. Generally in UserPrincipalName (UPN) format, e.g. <c>[email protected]</c></param> /// <param name="behavior">Designed interactive experience for the user.</param> /// <param name="extraQueryParameters">This parameter will be appended as is to the query string in the HTTP authentication request to the authority. /// This is expected to be a string of segments of the form <c>key=value</c> separated by an ampersand character. /// The parameter can be null.</param> /// <param name="parent">Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.</param> /// <returns>Authentication result containing a token for the requested scopes and account</returns> public Task<AuthenticationResult> AcquireTokenAsync(IEnumerable<string> scopes, string loginHint, UIBehavior behavior, string extraQueryParameters, UIParent parent) { throw new NotImplementedException(); }
/// <summary> /// Interactive request to acquire token for the specified scopes. The user will need to sign-in but an account will be proposed /// based on the provided <paramref name="account"/> /// </summary> /// <param name="scopes">Scopes requested to access a protected API</param> /// <param name="account">Account to use for the interactive token acquisition. See <see cref="IAccount"/> for ways to get an account</param> /// <param name="parent">Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.</param> /// <returns>Authentication result containing a token for the requested scopes and account</returns> public Task<AuthenticationResult> AcquireTokenAsync( IEnumerable<string> scopes, IAccount account, UIParent parent) { throw new NotImplementedException(); }
public async Task <bool> AccountRegistrationRequestEmailValidationAsync(IEnumerable <string> scopes, string authority, UIParent parent, string email) { Authority authorityInstance = Instance.Authority.CreateAuthority(ServiceBundle, authority, ValidateAuthority); var requestParams = CreateRequestParameters(authorityInstance, scopes, (IAccount)null, null); requestParams.ExtraQueryParameters = string.Empty; var behavior = UIBehavior.SelectAccount; _registerAccountRequest = new NonInteractiveRegisterAccountRequest( ServiceBundle, requestParams, ApiEvent.ApiIds.AcquireTokenWithScopeUserBehaviorAuthority, null, behavior, CreateWebAuthenticationDialog(parent, behavior, requestParams.RequestContext), email); return((await _registerAccountRequest.RunAsync(CancellationToken.None).ConfigureAwait(false)) != null); }
public IWebUI CreateAuthenticationDialog(UIParent parent, RequestContext requestContext) { throw new NotImplementedException(); }
/// <summary> /// Interactive request to acquire token for a login with control of the UI behavior and possiblity of passing extra query parameters like additional claims /// </summary> /// <param name="scopes">Scopes requested to access a protected API</param> /// <param name="loginHint">Identifier of the user. Generally in UserPrincipalName (UPN) format, e.g. <c>[email protected]</c></param> /// <param name="behavior">Designed interactive experience for the user.</param> /// <param name="extraQueryParameters">This parameter will be appended as is to the query string in the HTTP authentication request to the authority. /// This is expected to be a string of segments of the form <c>key=value</c> separated by an ampersand character. /// The parameter can be null.</param> /// <param name="parent">Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.</param> /// <returns>Authentication result containing a token for the requested scopes and account</returns> public async Task <AuthenticationResult> AcquireTokenAsync(IEnumerable <string> scopes, string loginHint, UIBehavior behavior, string extraQueryParameters, UIParent parent) { GuardNetCore(); Authority authority = Instance.Authority.CreateAuthority(ServiceBundle, Authority, ValidateAuthority); return (await AcquireTokenForLoginHintCommonAsync(authority, scopes, null, loginHint, behavior, extraQueryParameters, parent, ApiEvent.ApiIds.AcquireTokenWithScopeHintBehavior).ConfigureAwait(false)); }
private async Task <AuthenticationResult> AcquireTokenForUserCommonAsync(Authority authority, IEnumerable <string> scopes, IEnumerable <string> extraScopesToConsent, IUser user, UIBehavior behavior, string extraQueryParameters, UIParent parent, ApiEvent.ApiIds apiId) { var requestParams = CreateRequestParameters(authority, scopes, user, UserTokenCache); requestParams.ExtraQueryParameters = extraQueryParameters; var handler = new InteractiveRequest(requestParams, extraScopesToConsent, behavior, CreateWebAuthenticationDialog(parent, behavior, requestParams.RequestContext)) { ApiId = apiId }; return(await handler.RunAsync().ConfigureAwait(false)); }
/// <summary> /// Interactive request to acquire token. /// </summary> /// <param name="scopes">Array of scopes requested for resource</param> /// <param name="loginHint">Identifier of the user. Generally a UPN.</param> /// <param name="behavior">Enumeration to control UI behavior.</param> /// <param name="extraQueryParameters">This parameter will be appended as is to the query string in the HTTP authentication request to the authority. The parameter can be null.</param> /// <param name="extraScopesToConsent">Array of scopes for which a developer can request consent upfront.</param> /// <param name="authority">Specific authority for which the token is requested. Passing a different value than configured does not change the configured value</param> /// <param name="parent">Object contains reference to parent window/activity. REQUIRED for Xamarin.Android only.</param> /// <returns>Authentication result containing token of the user</returns> public async Task <AuthenticationResult> AcquireTokenAsync(IEnumerable <string> scopes, string loginHint, UIBehavior behavior, string extraQueryParameters, IEnumerable <string> extraScopesToConsent, string authority, UIParent parent) { Authority authorityInstance = Internal.Instance.Authority.CreateAuthority(authority, ValidateAuthority); return (await AcquireTokenForLoginHintCommonAsync(authorityInstance, scopes, extraScopesToConsent, loginHint, behavior, extraQueryParameters, parent, ApiEvent.ApiIds.AcquireTokenWithScopeHintBehaviorAuthority).ConfigureAwait(false)); }
/// <summary> /// Interactive request to acquire token for a given account, with the possibility of controlling the user experience, passing extra query /// parameters, providing extra scopes that the user can pre-consent to, and overriding the authority pre-configured in the application /// </summary> /// <param name="scopes">Scopes requested to access a protected API</param> /// <param name="account">Account to use for the interactive token acquisition. See <see cref="IAccount"/> for ways to get an account</param> /// <param name="behavior">Designed interactive experience for the user.</param> /// <param name="extraQueryParameters">This parameter will be appended as is to the query string in the HTTP authentication request to the authority. /// This is expected to be a string of segments of the form <c>key=value</c> separated by an ampersand character. /// The parameter can be null.</param> /// <param name="extraScopesToConsent">scopes that you can request the end user to consent upfront, in addition to the scopes for the protected Web API /// for which you want to acquire a security token.</param> /// <param name="authority">Specific authority for which the token is requested. Passing a different value than configured does not change the configured value</param> /// <param name="parent">Object containing a reference to the parent window/activity. REQUIRED for Xamarin.Android only.</param> /// <returns>Authentication result containing a token for the requested scopes and account</returns> public async Task <AuthenticationResult> AcquireTokenAsync(IEnumerable <string> scopes, IAccount account, UIBehavior behavior, string extraQueryParameters, IEnumerable <string> extraScopesToConsent, string authority, UIParent parent) { GuardNetCore(); Authority authorityInstance = Instance.Authority.CreateAuthority(ServiceBundle, authority, ValidateAuthority); return (await AcquireTokenForUserCommonAsync(authorityInstance, scopes, extraScopesToConsent, account, behavior, extraQueryParameters, parent, ApiEvent.ApiIds.AcquireTokenWithScopeUserBehaviorAuthority).ConfigureAwait(false)); }
public async Task <AuthenticationResult> AttemptAcquireTokenAsync(IEnumerable <string> scopes, IAccount account, UIBehavior behavior, string extraQueryParameters, IEnumerable <string> extraScopesToConsent, string authority, UIParent parent, string userName, string password) { return(await AcquireTokenAsync(scopes, account, behavior, extraQueryParameters, extraScopesToConsent, authority, parent, userName, password, false).ConfigureAwait(false)); }
private async Task <AuthenticationResult> AcquireTokenAsync(IEnumerable <string> scopes, IAccount account, UIBehavior behavior, string extraQueryParameters, IEnumerable <string> extraScopesToConsent, string authority, UIParent parent, string userName, string password, bool cacheResult) { Authority authorityInstance = Instance.Authority.CreateAuthority(ServiceBundle, authority, ValidateAuthority); var requestParams = CreateRequestParameters(authorityInstance, scopes, account, cacheResult ? UserTokenCache : null); requestParams.ExtraQueryParameters = extraQueryParameters; var handler = new NonInteractiveLoginRequest( ServiceBundle, requestParams, ApiEvent.ApiIds.AcquireTokenWithScopeUserBehaviorAuthority, extraScopesToConsent, behavior, CreateWebAuthenticationDialog(parent, behavior, requestParams.RequestContext), userName, password); return(await handler.RunAsync(CancellationToken.None).ConfigureAwait(false)); }
public WebUI(UIParent parent, RequestContext requestContext) { useCorporateNetwork = parent.UseCorporateNetwork; silentMode = parent.UseHiddenBrowser; }