OAuthProviderSync
Assembly: ServiceStack.dll
View Source
public abstract class OAuthProviderSync : AuthProviderSync, IAuthPlugin, IOAuthProvider, IAuthProvider
Properties
Type
View Source
public override string Type { get; }
VerifyAccessToken
View Source
public Func<string, bool> VerifyAccessToken { get; set; }
Meta
View Source
public override Dictionary<string, string> Meta { get; }
AuthHttpGateway
View Source
public IAuthHttpGateway AuthHttpGateway { get; set; }
ConsumerKey
View Source
public string ConsumerKey { get; set; }
ConsumerSecret
View Source
public string ConsumerSecret { get; set; }
RequestTokenUrl
View Source
public string RequestTokenUrl { get; set; }
AuthorizeUrl
View Source
public string AuthorizeUrl { get; set; }
AccessTokenUrl
View Source
public string AccessTokenUrl { get; set; }
UserProfileUrl
View Source
public string UserProfileUrl { get; set; }
VerifyTokenUrl
View Source
public string VerifyTokenUrl { get; set; }
IssuerSigningKeysUrl
View Source
public string IssuerSigningKeysUrl { get; set; }
OAuthUtils
View Source
public OAuthAuthorizer OAuthUtils { get; set; }
Inherited Properties
AccountLockedValidator
View Source
public Func<IAuthRepository, IUserAuth, IAuthTokens, bool> AccountLockedValidator { get; set; }
AuthEvents
View Source
public IAuthEvents AuthEvents { get; }
AuthRealm
View Source
public string AuthRealm { get; set; }
CallbackUrl
View Source
public string CallbackUrl { get; set; }
CustomValidationFilter
View Source
public Func<AuthContext, IHttpResult> CustomValidationFilter { get; set; }
ExcludeAuthInfoItems
View Source
public HashSet<string> ExcludeAuthInfoItems { get; set; }
LoadUserAuthFilter
View Source
public Action<AuthUserSession, IAuthTokens, Dictionary<string, string>> LoadUserAuthFilter { get; set; }
Meta
View Source
public virtual Dictionary<string, string> Meta { get; }
NavItem
View Source
public NavItem NavItem { get; set; }
PersistSession
View Source
public bool PersistSession { get; set; }
Provider
View Source
public string Provider { get; set; }
RedirectUrl
View Source
public string RedirectUrl { get; set; }
RestoreSessionFromState
View Source
public bool? RestoreSessionFromState { get; set; }
SaveExtendedUserInfo
View Source
public bool SaveExtendedUserInfo { get; set; }
SessionExpiry
View Source
public TimeSpan? SessionExpiry { get; set; }
Type
View Source
public virtual string Type { get; }
Fields
ConsumerKeyName
View Source
protected readonly string ConsumerKeyName
ConsumerSecretName
View Source
protected readonly string ConsumerSecretName
Methods
IsAuthorized(IAuthSession, IAuthTokens, Authenticate)
View Source
public override bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Authenticate request = null)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
ServiceStack.Authenticate | request |
AssertValidState()
View Source
protected virtual void AssertValidState()
AssertConsumerSecret()
View Source
protected virtual void AssertConsumerSecret()
AssertConsumerKey()
View Source
protected virtual void AssertConsumerKey()
Authenticate(IServiceBase, IAuthSession, Authenticate)
The entry point for all AuthProvider providers. Runs inside the AuthService so exceptions are treated normally. Overridable so you can provide your own Auth implementation.
View Source
public abstract override object Authenticate(IServiceBase authService, IAuthSession session, Authenticate request)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Authenticate | request |
Init(IServiceBase, ref IAuthSession, Authenticate)
Sets the CallbackUrl and session.ReferrerUrl if not set and initializes the session tokens for this AuthProvider
View Source
protected IAuthTokens Init(IServiceBase authService, ref IAuthSession session, Authenticate request)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Authenticate | request |
LoadUserOAuthProvider(IAuthSession, IAuthTokens)
View Source
public virtual void LoadUserOAuthProvider(IAuthSession userSession, IAuthTokens tokens)
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | userSession |
ServiceStack.Auth.IAuthTokens | tokens |
Inherited Methods
Authenticate(IServiceBase, IAuthSession, Authenticate)
View Source
public abstract object Authenticate(IServiceBase authService, IAuthSession session, Authenticate request)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Authenticate | request |
AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)
View Source
public Task<object> AuthenticateAsync(IServiceBase authService, IAuthSession session, Authenticate request, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Authenticate | request |
System.Threading.CancellationToken | token |
ConvertToClientError(Object, Boolean)
View Source
protected virtual object ConvertToClientError(object failedResult, bool isHtml)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Object | failedResult |
System.Boolean | isHtml |
CreateOrMergeAuthSession(IAuthSession, IAuthTokens)
View Source
public virtual string CreateOrMergeAuthSession(IAuthSession session, IAuthTokens tokens)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
EmailAlreadyExists(IAuthRepository, IUserAuth, IAuthTokens)
View Source
protected virtual bool EmailAlreadyExists(IAuthRepository authRepo, IUserAuth userAuth, IAuthTokens tokens = null)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthRepository | authRepo |
ServiceStack.Auth.IUserAuth | userAuth |
ServiceStack.Auth.IAuthTokens | tokens |
FallbackConfig(String)
Allows specifying a global fallback config that if exists is formatted with the Provider as the first arg. E.g. this appSetting with the TwitterAuthProvider: oauth.CallbackUrl="http://localhost:11001/auth/{0}" Would result in: oauth.CallbackUrl="http://localhost:11001/auth/twitter"
View Source
protected string FallbackConfig(string fallback)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | fallback |
GetAuthRedirectUrl(IServiceBase, IAuthSession)
View Source
protected virtual string GetAuthRedirectUrl(IServiceBase authService, IAuthSession session)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
GetAuthRepository(IRequest)
View Source
protected virtual IAuthRepository GetAuthRepository(IRequest req)
Returns
ServiceStack.Auth.IAuthRepository
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetReferrerUrl(IServiceBase, IAuthSession, Authenticate)
View Source
protected virtual string GetReferrerUrl(IServiceBase authService, IAuthSession session, Authenticate request = null)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Authenticate | request |
IsAccountLocked(IAuthRepository, IUserAuth, IAuthTokens)
View Source
public virtual bool IsAccountLocked(IAuthRepository authRepo, IUserAuth userAuth, IAuthTokens tokens = null)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthRepository | authRepo |
ServiceStack.Auth.IUserAuth | userAuth |
ServiceStack.Auth.IAuthTokens | tokens |
IsAuthorized(IAuthSession, IAuthTokens, Authenticate)
View Source
public abstract bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Authenticate request = null)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
ServiceStack.Authenticate | request |
LoadUserAuthInfo(AuthUserSession, IAuthTokens, Dictionary<String, String>)
View Source
protected virtual void LoadUserAuthInfo(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo)
Parameters
Type | Name |
---|---|
ServiceStack.AuthUserSession | userSession |
ServiceStack.Auth.IAuthTokens | tokens |
System.Collections.Generic.Dictionary<System.String,System.String> | authInfo |
LoginMatchesSession(IAuthSession, String)
View Source
protected static bool LoginMatchesSession(IAuthSession session, string userName)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
System.String | userName |
Logout(IServiceBase, Authenticate)
Remove the Users Session
View Source
public virtual object Logout(IServiceBase service, Authenticate request)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | service |
ServiceStack.Authenticate | request |
LogoutAsync(IServiceBase, Authenticate, CancellationToken)
View Source
public Task<object> LogoutAsync(IServiceBase service, Authenticate request, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | service |
ServiceStack.Authenticate | request |
System.Threading.CancellationToken | token |
OnAuthenticated(IServiceBase, IAuthSession, IAuthTokens, Dictionary<String, String>)
View Source
public virtual IHttpResult OnAuthenticated(IServiceBase authService, IAuthSession session, IAuthTokens tokens, Dictionary<string, string> authInfo)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
System.Collections.Generic.Dictionary<System.String,System.String> | authInfo |
OnFailedAuthentication(IAuthSession, IRequest, IResponse)
View Source
public virtual Task OnFailedAuthentication(IAuthSession session, IRequest httpReq, IResponse httpRes)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
Register(IAppHost, AuthFeature)
View Source
public virtual void Register(IAppHost appHost, AuthFeature feature)
Parameters
Type | Name |
---|---|
ServiceStack.IAppHost | appHost |
ServiceStack.AuthFeature | feature |
UrlFilter(AuthProviderSync, String)
View Source
public static string UrlFilter(AuthProviderSync provider, string url)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Auth.AuthProviderSync | provider |
System.String | url |
UserNameAlreadyExists(IAuthRepository, IUserAuth, IAuthTokens)
View Source
protected virtual bool UserNameAlreadyExists(IAuthRepository authRepo, IUserAuth userAuth, IAuthTokens tokens = null)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthRepository | authRepo |
ServiceStack.Auth.IUserAuth | userAuth |
ServiceStack.Auth.IAuthTokens | tokens |
ValidateAccount(IServiceBase, IAuthRepository, IAuthSession, IAuthTokens)
View Source
protected virtual IHttpResult ValidateAccount(IServiceBase authService, IAuthRepository authRepo, IAuthSession session, IAuthTokens tokens)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthRepository | authRepo |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |