OAuth2Provider
Assembly: ServiceStack.dll
View Source
public abstract class OAuth2Provider : OAuthProvider, IAuthPlugin, IOAuthProvider, IAuthProvider
Properties
Scopes
View Source
public string[] Scopes { get; set; }
ResponseMode
View Source
public string ResponseMode { get; set; }
ResolveUnknownDisplayName
Custom DisplayName resolver function when not provided
View Source
public Func<IAuthSession, IAuthTokens, string> ResolveUnknownDisplayName { get; set; }
Inherited Properties
AccessTokenUrl
View Source
public string AccessTokenUrl { get; set; }
AuthHttpGateway
View Source
public IAuthHttpGateway AuthHttpGateway { get; set; }
AuthorizeUrl
View Source
public string AuthorizeUrl { get; set; }
ConsumerKey
View Source
public string ConsumerKey { get; set; }
ConsumerSecret
View Source
public string ConsumerSecret { get; set; }
IssuerSigningKeysUrl
View Source
public string IssuerSigningKeysUrl { get; set; }
Meta
View Source
public override Dictionary<string, string> Meta { get; }
OAuthUtils
View Source
public OAuthAuthorizer OAuthUtils { get; set; }
RequestTokenUrl
View Source
public string RequestTokenUrl { get; set; }
Type
View Source
public override string Type { get; }
UserProfileUrl
View Source
public string UserProfileUrl { get; set; }
VerifyAccessTokenAsync
View Source
public Func<string, AuthContext, Task<bool>> VerifyAccessTokenAsync { get; set; }
VerifyTokenUrl
View Source
public string VerifyTokenUrl { get; set; }
Methods
AssertValidState()
View Source
protected override void AssertValidState()
AssertAccessTokenUrl()
View Source
protected virtual void AssertAccessTokenUrl()
AssertAuthorizeUrl()
View Source
protected virtual void AssertAuthorizeUrl()
AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)
View Source
public override async 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 |
GetAccessTokenJsonAsync(String, AuthContext, CancellationToken)
View Source
protected virtual async Task<string> GetAccessTokenJsonAsync(string code, AuthContext ctx, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|---|
System.String | code |
ServiceStack.Auth.AuthContext | ctx |
System.Threading.CancellationToken | token |
AuthenticateWithAccessTokenAsync(IServiceBase, IAuthSession, IAuthTokens, String, Dictionary<String, String>, CancellationToken)
View Source
protected virtual async Task<object> AuthenticateWithAccessTokenAsync(IServiceBase authService, IAuthSession session, IAuthTokens tokens, string accessToken, Dictionary<string, string> authInfo = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
System.String | accessToken |
System.Collections.Generic.Dictionary<System.String,System.String> | authInfo |
System.Threading.CancellationToken | token |
CreateAuthInfoAsync(String, CancellationToken)
View Source
protected abstract Task<Dictionary<string, string>> CreateAuthInfoAsync(string accessToken, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<System.String,System.String>>
Parameters
Type | Name |
---|---|
System.String | accessToken |
System.Threading.CancellationToken | token |
GetUserAuthName(IAuthTokens, Dictionary<String, String>)
Override to return User chosen username or Email for this AuthProvider
View Source
protected virtual string GetUserAuthName(IAuthTokens tokens, Dictionary<string, string> authInfo)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthTokens | tokens |
System.Collections.Generic.Dictionary<System.String,System.String> | authInfo |
LoadUserAuthInfoAsync(AuthUserSession, IAuthTokens, Dictionary<String, String>, CancellationToken)
View Source
protected override Task LoadUserAuthInfoAsync(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.AuthUserSession | userSession |
ServiceStack.Auth.IAuthTokens | tokens |
System.Collections.Generic.Dictionary<System.String,System.String> | authInfo |
System.Threading.CancellationToken | token |
LoadUserOAuthProviderAsync(IAuthSession, IAuthTokens)
View Source
public override Task LoadUserOAuthProviderAsync(IAuthSession authSession, IAuthTokens tokens)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | authSession |
ServiceStack.Auth.IAuthTokens | tokens |
Inherited Methods
AssertConsumerKey()
View Source
protected virtual void AssertConsumerKey()
AssertConsumerSecret()
View Source
protected virtual void AssertConsumerSecret()
AssertValidState()
View Source
protected virtual void AssertValidState()
AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)
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 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 |
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 |
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 |
LoadUserOAuthProviderAsync(IAuthSession, IAuthTokens)
View Source
public virtual Task LoadUserOAuthProviderAsync(IAuthSession userSession, IAuthTokens tokens)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | userSession |
ServiceStack.Auth.IAuthTokens | tokens |