Skip to main content

AppleAuthProvider

Required to use Sign In with Apple:

Assembly: ServiceStack.Extensions.dll​
View Source​
Declaration
public class AppleAuthProvider : OAuth2Provider, IOAuthProvider, IAuthProvider, IAuthPlugin

Properties​

Audience​

The audience used in JWT Client Secret. Default: https://appleid.apple.com

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

TeamId​

Apple Developer Membership Team ID

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

ClientId​

Service ID

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

BundleId​

Bundle ID

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

KeyId​

The Private Key ID

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

KeyPath​

Path to .p8 Private Key

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

KeyBase64​

Base64 of .p8 Private Key bytes

View Source​
Declaration
public string KeyBase64 { set; }

KeyBytes​

.p8 Private Key bytes

View Source​
Declaration
public byte[] KeyBytes { get; set; }

ClientSecretFactory​

Customize ClientSecret JWT

View Source​
Declaration
public Func<AppleAuthProvider, string> ClientSecretFactory { get; set; }

ClientSecretExpiry​

When JWT Client Secret expires, defaults to Apple Max 6 Month Expiry

View Source​
Declaration
public TimeSpan ClientSecretExpiry { get; set; }

IssuerSigningKeysJson​

Optional: static list of Apple's public keys, defaults to fetching from https://appleid.apple.com/auth/keys

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

CacheKey​

Whether to cache private Key if loading from KeyPath, defaults: true

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

CacheIssuerSigningKeys​

Whether to cache Apple's public keys, defaults: true

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

ValidateRefreshTokenExpiry​

How long before re-validating Sign in RefreshToken, default: 1 day. Set to null to disable RefreshToken validation.

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

Inherited Properties​

ResolveUnknownDisplayName​

Custom DisplayName resolver function when not provided

View Source​
Declaration
public Func<IAuthSession, IAuthTokens, string> ResolveUnknownDisplayName { get; set; }

ResponseMode​

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

Scopes​

View Source​
Declaration
public string[] Scopes { get; set; }

Fields​

Name​

View Source​
Declaration
public const string Name = null

Realm​

View Source​
Declaration
public static string Realm

DefaultAudience​

View Source​
Declaration
public const string DefaultAudience = null

DefaultAuthorizeUrl​

View Source​
Declaration
public const string DefaultAuthorizeUrl = null

DefaultAccessTokenUrl​

View Source​
Declaration
public const string DefaultAccessTokenUrl = null

DefaultIssuerSigningKeysUrl​

View Source​
Declaration
public const string DefaultIssuerSigningKeysUrl = null

Methods​

Register(IAppHost, AuthFeature)​

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

OnVerifyAccessTokenAsync(String, AuthContext)​

View Source​
Declaration
public virtual async Task<bool> OnVerifyAccessTokenAsync(string idToken, AuthContext ctx)
Returns​

Task<System.Boolean>

Parameters​
TypeName
System.StringidToken
ServiceStack.Auth.AuthContextctx

ValidateRefreshToken(String, String, AuthContext)​

View Source​
Declaration
public async Task<string> ValidateRefreshToken(string refreshToken, string clientId, AuthContext ctx)
Returns​

Task<System.String>

Parameters​
TypeName
System.StringrefreshToken
System.StringclientId
ServiceStack.Auth.AuthContextctx

AssertValidState()​

View Source​
Declaration
protected override void AssertValidState()

AssertConsumerSecret()​

View Source​
Declaration
protected override void AssertConsumerSecret()

GetClientSecret(String)​

View Source​
Declaration
protected virtual string GetClientSecret(string clientId)
Returns​

System.String

Parameters​
TypeName
System.StringclientId

GetPrivateKeyBytes()​

View Source​
Declaration
protected virtual byte[] GetPrivateKeyBytes()
Returns​

System.Byte[]

GetAccessTokenJsonAsync(String, AuthContext, CancellationToken)​

View Source​
Declaration
protected override async Task<string> GetAccessTokenJsonAsync(string code, AuthContext ctx, CancellationToken token = null)
Returns​

Task<System.String>

Parameters​
TypeName
System.Stringcode
ServiceStack.Auth.AuthContextctx
CancellationTokentoken

GetRedirectUri(AuthContext)​

View Source​
Declaration
protected virtual string GetRedirectUri(AuthContext ctx)
Returns​

System.String

Parameters​
TypeName
ServiceStack.Auth.AuthContextctx

GetIssuerSigningKeysJson()​

View Source​
Declaration
protected virtual string GetIssuerSigningKeysJson()
Returns​

System.String

AuthenticateWithAccessTokenAsync(IServiceBase, IAuthSession, IAuthTokens, String, Dictionary<String, String>, CancellationToken)​

View Source​
Declaration
protected override async Task<object> AuthenticateWithAccessTokenAsync(IServiceBase authService, IAuthSession session, IAuthTokens tokens, string accessToken, Dictionary<string, string> authInfo = null, CancellationToken token = null)
Returns​

Task<System.Object>

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

ValidateIdentityToken(String)​

View Source​
Declaration
public void ValidateIdentityToken(string idToken)
Parameters​
TypeName
System.StringidToken

CreateAuthInfoAsync(String, CancellationToken)​

View Source​
Declaration
protected override Task<Dictionary<string, string>> CreateAuthInfoAsync(string idToken, CancellationToken token = null)
Returns​

Task<Dictionary<System.String,System.String>>

Parameters​
TypeName
System.StringidToken
CancellationTokentoken

DefaultResolveUnknownDisplayName(IAuthSession, IAuthTokens)​

View Source​
Declaration
public static string DefaultResolveUnknownDisplayName(IAuthSession authSession, IAuthTokens tokens)
Returns​

System.String

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionauthSession
ServiceStack.Auth.IAuthTokenstokens

LoadUserAuthInfoAsync(AuthUserSession, IAuthTokens, Dictionary<String, String>, CancellationToken)​

View Source​
Declaration
protected override Task LoadUserAuthInfoAsync(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo, CancellationToken token = null)
Returns​

Task

Parameters​
TypeName
ServiceStack.AuthUserSessionuserSession
ServiceStack.Auth.IAuthTokenstokens
Dictionary<System.String,System.String>authInfo
CancellationTokentoken

Inherited Methods​

AssertAccessTokenUrl()​

View Source​
Declaration
protected virtual void AssertAccessTokenUrl()

AssertAuthorizeUrl()​

View Source​
Declaration
protected virtual void AssertAuthorizeUrl()

AssertValidState()​

View Source​
Declaration
protected override void AssertValidState()

AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)​

View Source​
Declaration
public override async 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

AuthenticateWithAccessTokenAsync(IServiceBase, IAuthSession, IAuthTokens, String, Dictionary<String, String>, CancellationToken)​

View Source​
Declaration
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​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens
System.StringaccessToken
System.Collections.Generic.Dictionary<System.String,System.String>authInfo
System.Threading.CancellationTokentoken

CreateAuthInfoAsync(String, CancellationToken)​

View Source​
Declaration
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​
TypeName
System.StringaccessToken
System.Threading.CancellationTokentoken

GetAccessTokenJsonAsync(String, AuthContext, CancellationToken)​

View Source​
Declaration
protected virtual async Task<string> GetAccessTokenJsonAsync(string code, AuthContext ctx, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.String>

Parameters​
TypeName
System.Stringcode
ServiceStack.Auth.AuthContextctx
System.Threading.CancellationTokentoken

GetUserAuthName(IAuthTokens, Dictionary<String, String>)​

Override to return User chosen username or Email for this AuthProvider

View Source​
Declaration
protected virtual string GetUserAuthName(IAuthTokens tokens, Dictionary<string, string> authInfo)
Returns​

System.String

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

LoadUserAuthInfoAsync(AuthUserSession, IAuthTokens, Dictionary<String, String>, CancellationToken)​

View Source​
Declaration
protected override Task LoadUserAuthInfoAsync(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.AuthUserSessionuserSession
ServiceStack.Auth.IAuthTokenstokens
System.Collections.Generic.Dictionary<System.String,System.String>authInfo
System.Threading.CancellationTokentoken

LoadUserOAuthProviderAsync(IAuthSession, IAuthTokens)​

View Source​
Declaration
public override Task LoadUserOAuthProviderAsync(IAuthSession authSession, IAuthTokens tokens)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionauthSession
ServiceStack.Auth.IAuthTokenstokens

Implements​