Skip to main content

OAuthProviderSync

Assembly: ServiceStack.dll​
View Source​
Declaration
public abstract class OAuthProviderSync : AuthProviderSync, IAuthPlugin, IOAuthProvider, IAuthProvider

Properties​

Type​

View Source​
Declaration
public override string Type { get; }

VerifyAccessToken​

View Source​
Declaration
public Func<string, bool> VerifyAccessToken { get; set; }

Meta​

View Source​
Declaration
public override Dictionary<string, string> Meta { get; }

AuthHttpGateway​

View Source​
Declaration
public IAuthHttpGateway AuthHttpGateway { get; set; }

ConsumerKey​

View Source​
Declaration
public string ConsumerKey { get; set; }

ConsumerSecret​

View Source​
Declaration
public string ConsumerSecret { get; set; }

RequestTokenUrl​

View Source​
Declaration
public string RequestTokenUrl { get; set; }

AuthorizeUrl​

View Source​
Declaration
public string AuthorizeUrl { get; set; }

AccessTokenUrl​

View Source​
Declaration
public string AccessTokenUrl { get; set; }

UserProfileUrl​

View Source​
Declaration
public string UserProfileUrl { get; set; }

VerifyTokenUrl​

View Source​
Declaration
public string VerifyTokenUrl { get; set; }

IssuerSigningKeysUrl​

View Source​
Declaration
public string IssuerSigningKeysUrl { get; set; }

OAuthUtils​

View Source​
Declaration
public OAuthAuthorizer OAuthUtils { get; set; }

Inherited Properties​

AccountLockedValidator​

View Source​
Declaration
public Func<IAuthRepository, IUserAuth, IAuthTokens, bool> AccountLockedValidator { get; set; }

AuthEvents​

View Source​
Declaration
public IAuthEvents AuthEvents { get; }

AuthRealm​

View Source​
Declaration
public string AuthRealm { get; set; }

CallbackUrl​

View Source​
Declaration
public string CallbackUrl { get; set; }

CustomValidationFilter​

View Source​
Declaration
public Func<AuthContext, IHttpResult> CustomValidationFilter { get; set; }

ExcludeAuthInfoItems​

View Source​
Declaration
public HashSet<string> ExcludeAuthInfoItems { get; set; }

LoadUserAuthFilter​

View Source​
Declaration
public Action<AuthUserSession, IAuthTokens, Dictionary<string, string>> LoadUserAuthFilter { get; set; }

Meta​

View Source​
Declaration
public virtual Dictionary<string, string> Meta { get; }

NavItem​

View Source​
Declaration
public NavItem NavItem { get; set; }

PersistSession​

View Source​
Declaration
public bool PersistSession { get; set; }

Provider​

View Source​
Declaration
public string Provider { get; set; }

RedirectUrl​

View Source​
Declaration
public string RedirectUrl { get; set; }

RestoreSessionFromState​

View Source​
Declaration
public bool? RestoreSessionFromState { get; set; }

SaveExtendedUserInfo​

View Source​
Declaration
public bool SaveExtendedUserInfo { get; set; }

SessionExpiry​

View Source​
Declaration
public TimeSpan? SessionExpiry { get; set; }

Type​

View Source​
Declaration
public virtual string Type { get; }

Fields​

ConsumerKeyName​

View Source​
Declaration
protected readonly string ConsumerKeyName

ConsumerSecretName​

View Source​
Declaration
protected readonly string ConsumerSecretName

Methods​

IsAuthorized(IAuthSession, IAuthTokens, Authenticate)​

View Source​
Declaration
public override bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Authenticate request = null)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens
ServiceStack.Authenticaterequest

AssertValidState()​

View Source​
Declaration
protected virtual void AssertValidState()

AssertConsumerSecret()​

View Source​
Declaration
protected virtual void AssertConsumerSecret()

AssertConsumerKey()​

View Source​
Declaration
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​
Declaration
public abstract override object Authenticate(IServiceBase authService, IAuthSession session, Authenticate request)
Returns​

System.Object

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Authenticaterequest

Init(IServiceBase, ref IAuthSession, Authenticate)​

Sets the CallbackUrl and session.ReferrerUrl if not set and initializes the session tokens for this AuthProvider

View Source​
Declaration
protected IAuthTokens Init(IServiceBase authService, ref IAuthSession session, Authenticate request)
Returns​

ServiceStack.Auth.IAuthTokens

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Authenticaterequest

LoadUserOAuthProvider(IAuthSession, IAuthTokens)​

View Source​
Declaration
public virtual void LoadUserOAuthProvider(IAuthSession userSession, IAuthTokens tokens)
Parameters​
TypeName
ServiceStack.Auth.IAuthSessionuserSession
ServiceStack.Auth.IAuthTokenstokens

Inherited Methods​

Authenticate(IServiceBase, IAuthSession, Authenticate)​

View Source​
Declaration
public abstract object Authenticate(IServiceBase authService, IAuthSession session, Authenticate request)
Returns​

System.Object

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Authenticaterequest

AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)​

View Source​
Declaration
public Task<object> AuthenticateAsync(IServiceBase authService, IAuthSession session, Authenticate request, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Object>

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Authenticaterequest
System.Threading.CancellationTokentoken

ConvertToClientError(Object, Boolean)​

View Source​
Declaration
protected virtual object ConvertToClientError(object failedResult, bool isHtml)
Returns​

System.Object

Parameters​
TypeName
System.ObjectfailedResult
System.BooleanisHtml

CreateOrMergeAuthSession(IAuthSession, IAuthTokens)​

View Source​
Declaration
public virtual string CreateOrMergeAuthSession(IAuthSession session, IAuthTokens tokens)
Returns​

System.String

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens

EmailAlreadyExists(IAuthRepository, IUserAuth, IAuthTokens)​

View Source​
Declaration
protected virtual bool EmailAlreadyExists(IAuthRepository authRepo, IUserAuth userAuth, IAuthTokens tokens = null)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Auth.IAuthRepositoryauthRepo
ServiceStack.Auth.IUserAuthuserAuth
ServiceStack.Auth.IAuthTokenstokens

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​
Declaration
protected string FallbackConfig(string fallback)
Returns​

System.String

Parameters​
TypeName
System.Stringfallback

GetAuthRedirectUrl(IServiceBase, IAuthSession)​

View Source​
Declaration
protected virtual string GetAuthRedirectUrl(IServiceBase authService, IAuthSession session)
Returns​

System.String

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession

GetAuthRepository(IRequest)​

View Source​
Declaration
protected virtual IAuthRepository GetAuthRepository(IRequest req)
Returns​

ServiceStack.Auth.IAuthRepository

Parameters​
TypeName
ServiceStack.Web.IRequestreq

GetReferrerUrl(IServiceBase, IAuthSession, Authenticate)​

View Source​
Declaration
protected virtual string GetReferrerUrl(IServiceBase authService, IAuthSession session, Authenticate request = null)
Returns​

System.String

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Authenticaterequest

IsAccountLocked(IAuthRepository, IUserAuth, IAuthTokens)​

View Source​
Declaration
public virtual bool IsAccountLocked(IAuthRepository authRepo, IUserAuth userAuth, IAuthTokens tokens = null)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Auth.IAuthRepositoryauthRepo
ServiceStack.Auth.IUserAuthuserAuth
ServiceStack.Auth.IAuthTokenstokens

IsAuthorized(IAuthSession, IAuthTokens, Authenticate)​

View Source​
Declaration
public abstract bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Authenticate request = null)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens
ServiceStack.Authenticaterequest

LoadUserAuthInfo(AuthUserSession, IAuthTokens, Dictionary<String, String>)​

View Source​
Declaration
protected virtual void LoadUserAuthInfo(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo)
Parameters​
TypeName
ServiceStack.AuthUserSessionuserSession
ServiceStack.Auth.IAuthTokenstokens
System.Collections.Generic.Dictionary<System.String,System.String>authInfo

LoginMatchesSession(IAuthSession, String)​

View Source​
Declaration
protected static bool LoginMatchesSession(IAuthSession session, string userName)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
System.StringuserName

Logout(IServiceBase, Authenticate)​

Remove the Users Session

View Source​
Declaration
public virtual object Logout(IServiceBase service, Authenticate request)
Returns​

System.Object

Parameters​
TypeName
ServiceStack.IServiceBaseservice
ServiceStack.Authenticaterequest

LogoutAsync(IServiceBase, Authenticate, CancellationToken)​

View Source​
Declaration
public Task<object> LogoutAsync(IServiceBase service, Authenticate request, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Object>

Parameters​
TypeName
ServiceStack.IServiceBaseservice
ServiceStack.Authenticaterequest
System.Threading.CancellationTokentoken

OnAuthenticated(IServiceBase, IAuthSession, IAuthTokens, Dictionary<String, String>)​

View Source​
Declaration
public virtual IHttpResult OnAuthenticated(IServiceBase authService, IAuthSession session, IAuthTokens tokens, Dictionary<string, string> authInfo)
Returns​

ServiceStack.Web.IHttpResult

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens
System.Collections.Generic.Dictionary<System.String,System.String>authInfo

OnFailedAuthentication(IAuthSession, IRequest, IResponse)​

View Source​
Declaration
public virtual Task OnFailedAuthentication(IAuthSession session, IRequest httpReq, IResponse httpRes)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes

Register(IAppHost, AuthFeature)​

View Source​
Declaration
public virtual void Register(IAppHost appHost, AuthFeature feature)
Parameters​
TypeName
ServiceStack.IAppHostappHost
ServiceStack.AuthFeaturefeature

UrlFilter(AuthProviderSync, String)​

View Source​
Declaration
public static string UrlFilter(AuthProviderSync provider, string url)
Returns​

System.String

Parameters​
TypeName
ServiceStack.Auth.AuthProviderSyncprovider
System.Stringurl

UserNameAlreadyExists(IAuthRepository, IUserAuth, IAuthTokens)​

View Source​
Declaration
protected virtual bool UserNameAlreadyExists(IAuthRepository authRepo, IUserAuth userAuth, IAuthTokens tokens = null)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Auth.IAuthRepositoryauthRepo
ServiceStack.Auth.IUserAuthuserAuth
ServiceStack.Auth.IAuthTokenstokens

ValidateAccount(IServiceBase, IAuthRepository, IAuthSession, IAuthTokens)​

View Source​
Declaration
protected virtual IHttpResult ValidateAccount(IServiceBase authService, IAuthRepository authRepo, IAuthSession session, IAuthTokens tokens)
Returns​

ServiceStack.Web.IHttpResult

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthRepositoryauthRepo
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens

Implements​