public MsalAuthOptionsAggregate(MsalBrowserOptionsValueObject msalBrowserOptions, MsalCacheOptionsValueObject msalCacheOptions, MsalInteractionTypeValueObject interactionType, MsalScopeOptionsValueObject msalScopeOptions)
 {
     MsalBrowserOptions = msalBrowserOptions;
     MsalCacheOptions   = msalCacheOptions;
     InteractionType    = interactionType;
     MsalScopeOptions   = msalScopeOptions;
 }
Пример #2
0
    public MsalAuthOptionsAggregate GetOptions()
    {
        try
        {
            var azureAdOptions = _optionsProvider.Value;

            var browserOptions = new MsalBrowserOptionsValueObject(azureAdOptions.ClientId,
                                                                   azureAdOptions.Policies?.Authorities?[azureAdOptions.SignUpSignInPolicyId ?? string.Empty],
                                                                   azureAdOptions.Policies?.KnownAuthorities, azureAdOptions.RedirectUrl,
                                                                   azureAdOptions.PostLogoutRedirectUrl, azureAdOptions.NavigateToLoginRequestUrl, azureAdOptions.LoginFailedRoute);

            var cacheOptions =
                new MsalCacheOptionsValueObject(azureAdOptions.CacheLocation,
                                                azureAdOptions.CanOverrideStoreAuthStateInCookie, azureAdOptions.StoreAuthStateInCookie,
                                                azureAdOptions.SecureCookies);

            var interactionType = new MsalInteractionTypeValueObject(azureAdOptions.InteractionType);

            var scopeOptions = new MsalScopeOptionsValueObject(azureAdOptions?.ScopeOptions?.Scopes,
                                                               azureAdOptions?.ScopeOptions?.ProtectedResources);

            return(new MsalAuthOptionsAggregate(browserOptions, cacheOptions, interactionType, scopeOptions));
        }
        catch (InvalidBrowserAuthOptionsException invalidBrowserAuthOptionsException)
        {
            throw new InvalidMsalAuthOptionsException("Invalid browser exception", invalidBrowserAuthOptionsException);
        }
        catch (InvalidCacheOptionsException invalidCacheOptionsException)
        {
            throw new InvalidMsalAuthOptionsException("Invalid cache options exception", invalidCacheOptionsException);
        }
        catch (InvalidInteractionTypeException invalidInteractionTypeException)
        {
            throw new InvalidMsalAuthOptionsException("Invalid interaction type exception", invalidInteractionTypeException);
        }
        catch (InvalidScopeOptionsException invalidScopeOptionsException)
        {
            throw new InvalidMsalAuthOptionsException("Invalid scope options exception", invalidScopeOptionsException);
        }
    }
 public static MsalBrowserOptionsDto FromValueObject(MsalBrowserOptionsValueObject options)
 {
     return(new MsalBrowserOptionsDto(options.ClientId, options.Authority, options.KnownAuthorities, options.RedirectUri, options.PostLogoutRedirectUri, options.NavigateToLoginRequestUrl, options.LoginFailedRoute));
 }