public static OidcSettings UseRedirectToCallerAfterLogoutRedirect(this OidcSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.PreLogout          = (parameters, serviceProvider) => RegisterCurrentPage(parameters.StateData, serviceProvider);
            settings.PostLogoutRedirect = (user, stateData, serviceProvider) => NavigateToCallerPage(stateData, serviceProvider);
            return(settings);
        }
        public static OidcSettings UseDefaultActions(this OidcSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.PreAuthentication = (parameters, provider) => DoNothing(provider);
            settings.PreLogout         = (parameters, provider) => DoNothing(provider);

            settings.PostAuthenticationRedirect = (user, state, provider) => NavigateToRoot(provider);
            settings.PostAuthenticationPopup    = (user, state, provider) => DoNothing(provider);
            settings.PostLogoutRedirect         = (user, state, provider) => NavigateToRoot(provider);
            settings.PostLogoutPopup            = (user, state, provider) => DoNothing(provider);

            return(settings);
        }
        public static OidcSettings UseDefaultCallbackUris(this OidcSettings settings, Uri baseCallbackUri)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (baseCallbackUri == null)
            {
                throw new ArgumentNullException(nameof(baseCallbackUri));
            }

            const string routePath = "oidc/callbacks/";
            const string pagePath  = "_content/Sotsera.Blazor.Oidc/";

            settings.AuthenticationRedirectCallbackUri = $"{baseCallbackUri}{routePath}authentication-redirect";
            settings.LogoutRedirectCallbackUri         = $"{baseCallbackUri}{routePath}logout-redirect";
            settings.AuthenticationPopupCallbackUri    = $"{baseCallbackUri}{pagePath}authentication-popup.html";
            settings.LogoutPopupCallbackUri            = $"{baseCallbackUri}{pagePath}logout-popup.html";
            settings.SilentRenewCallbackUri            = $"{baseCallbackUri}{pagePath}silent-renew.html";

            return(settings);
        }
 public OidcHttpClient(OidcSettings settings, NavigationManager navigationManager)
 {
     BaseAddress = new Uri(navigationManager.Uri);
     Timeout     = settings.HttpClientTimeout;
 }
예제 #5
0
 public OidcHttpClient(OidcSettings settings, IUriHelper uriHelper)
 {
     BaseAddress = new Uri(uriHelper.GetBaseUri());
     Timeout     = settings.HttpClientTimeout;
 }