C# Class ServiceStack.Auth.ApiKeyAuthProvider

Enable access to protected Services using API Keys
Inheritance: ServiceStack.Auth.AuthProvider, IAuthWithRequest, IAuthPlugin
Mostra file Open project: ServiceStack/ServiceStack Class Usage Examples

Public Properties

Property Type Description
DefaultEnvironments string[]
DefaultKeySizeBytes int
DefaultTypes string[]

Public Methods

Method Description
ApiKeyAuthProvider ( ) : System
ApiKeyAuthProvider ( IAppSettings appSettings ) : System
Authenticate ( IServiceBase authService, IAuthSession session, Authenticate request ) : object
CreateApiKey ( string environment, string keyType, int sizeBytes ) : string
GenerateNewApiKeys ( string userId ) : List
GetSessionKey ( string apiKey ) : string
IsAuthorized ( IAuthSession session, IAuthTokens tokens, Authenticate request = null ) : bool
OnFailedAuthentication ( IAuthSession session, IRequest httpReq, IResponse httpRes ) : void
PreAuthenticate ( IRequest req, IResponse res ) : void
Register ( IAppHost appHost, AuthFeature feature ) : void

Protected Methods

Method Description
GetApiKey ( IRequest req, string apiKey ) : ApiKey
Init ( IAppSettings appSettings = null ) : void
ValidateApiKey ( ApiKey apiKey ) : void

Private Methods

Method Description
PreAuthenticateWithApiKey ( IRequest req, IResponse res, ApiKey apiKey ) : void

Method Details

ApiKeyAuthProvider() public method

public ApiKeyAuthProvider ( ) : System
return System

ApiKeyAuthProvider() public method

public ApiKeyAuthProvider ( IAppSettings appSettings ) : System
appSettings IAppSettings
return System

Authenticate() public method

public Authenticate ( IServiceBase authService, IAuthSession session, Authenticate request ) : object
authService IServiceBase
session IAuthSession
request Authenticate
return object

CreateApiKey() public method

public CreateApiKey ( string environment, string keyType, int sizeBytes ) : string
environment string
keyType string
sizeBytes int
return string

GenerateNewApiKeys() public method

public GenerateNewApiKeys ( string userId ) : List
userId string
return List

GetApiKey() protected method

protected GetApiKey ( IRequest req, string apiKey ) : ApiKey
req IRequest
apiKey string
return ApiKey

GetSessionKey() public static method

public static GetSessionKey ( string apiKey ) : string
apiKey string
return string

Init() protected method

protected Init ( IAppSettings appSettings = null ) : void
appSettings IAppSettings
return void

IsAuthorized() public method

public IsAuthorized ( IAuthSession session, IAuthTokens tokens, Authenticate request = null ) : bool
session IAuthSession
tokens IAuthTokens
request Authenticate
return bool

OnFailedAuthentication() public method

public OnFailedAuthentication ( IAuthSession session, IRequest httpReq, IResponse httpRes ) : void
session IAuthSession
httpReq IRequest
httpRes IResponse
return void

PreAuthenticate() public method

public PreAuthenticate ( IRequest req, IResponse res ) : void
req IRequest
res IResponse
return void

Register() public method

public Register ( IAppHost appHost, AuthFeature feature ) : void
appHost IAppHost
feature AuthFeature
return void

ValidateApiKey() protected method

protected ValidateApiKey ( ApiKey apiKey ) : void
apiKey ApiKey
return void

Property Details

DefaultEnvironments public_oe static_oe property

public static string[] DefaultEnvironments
return string[]

DefaultKeySizeBytes public_oe static_oe property

public static int DefaultKeySizeBytes
return int

DefaultTypes public_oe static_oe property

public static string[] DefaultTypes
return string[]