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);
        }
    }
예제 #3
0
 public static MsalScopeOptionsDto FromValueObject(MsalScopeOptionsValueObject msalScopeOptionsValueObject)
 {
     return(new MsalScopeOptionsDto(msalScopeOptionsValueObject.Scopes,
                                    msalScopeOptionsValueObject.ProtectedResources));
 }