public object redirectIfNotAuthenticated(ScriptScopeContext scope) { if (!isAuthenticated(scope)) { var url = AuthenticateAttribute.GetHtmlRedirectUrl(req(scope)); return(redirectTo(scope, url)); } return(IgnoreResult.Value); }
public bool isAuthenticated(ScriptScopeContext scope, string provider) { var request = scope.GetRequest(); #pragma warning disable CS0618 return(request != null && AuthenticateAttribute.Authenticate(request)); #pragma warning restore CS0618 }
public bool isAuthenticated(ScriptScopeContext scope) { var request = scope.GetRequest(); #pragma warning disable CS0618 return(request != null && AuthenticateAttribute.Authenticate(request, request.GetSession())); #pragma warning restore CS0618 }
public object redirectIfNotAuthenticated(ScriptScopeContext scope, string path) { if (!isAuthenticated(scope)) { var url = AuthenticateAttribute.GetHtmlRedirectUrl(req(scope), path, includeRedirectParam:true); return redirectTo(scope, url); } return IgnoreResult.Value; }
public static bool IsAuthorized(this IHasServiceStackProvider hasProvider, AuthenticateAttribute authAttr) { if (authAttr == null) { return(true); } var authSession = hasProvider.ServiceStackProvider.GetSession(); return(authSession != null && authSession.IsAuthenticated); }
public object redirectIfNotAuthenticated(ScriptScopeContext scope) { if (!isAuthenticated(scope)) { var url = AuthenticateAttribute.GetHtmlRedirectUrl(req(scope)); return(Context.DefaultMethods.@return(scope, new HttpResult(null, null, HttpStatusCode.Redirect) { Headers = { [HttpHeaders.Location] = url } })); } return(IgnoreResult.Value); }
public static bool IsAuthenticated(this IRequest req) { //Sync with [Authenticate] impl if (HostContext.HasValidAuthSecret(req)) { return(true); } var authProviders = AuthenticateService.GetAuthProviders(); AuthenticateAttribute.PreAuthenticate(req, authProviders); var session = req.GetSession(); return(session != null && authProviders.Any(x => session.IsAuthorized(x.Provider))); }
protected bool Equals(AuthenticateAttribute other) { return(base.Equals(other) && string.Equals(Provider, other.Provider) && string.Equals(HtmlRedirect, other.HtmlRedirect)); }
public static bool IsAuthenticated(this IRequest req) => AuthenticateAttribute.Authenticate(req, req.Dto);
public bool isAuthenticated(ScriptScopeContext scope, string provider) { var request = req(scope); return(request != null && AuthenticateAttribute.Authenticate(request)); }
public bool isAuthenticated(ScriptScopeContext scope) { var request = req(scope); return(request != null && AuthenticateAttribute.Authenticate(request, request.GetSession())); }
protected bool Equals(AuthenticateAttribute other) { return base.Equals(other) && string.Equals(Provider, other.Provider) && string.Equals(HtmlRedirect, other.HtmlRedirect); }
public static Task <bool> IsAuthenticatedAsync(this IRequest req) => AuthenticateAttribute.AuthenticateAsync(req, req.Dto);