C# Class ServiceStack.Authentication.Aad.AadAuthProvider

Azure Active Directory (AAD) Auth Provider
You must provide the `ClientId` and `ClientSecret`. They can be provided to the constructor, by setting the properties, or in the app.config appsettings under the following keys: `oauth.aad.ClientId` and `oauth.aad.ClientSecret` You may also provide the `TenantId` of your AAD resource. The Tenant ID can be found in the oauth2 endpoint as shown: https://login.microsoftonline.com/{TenantId}/oauth2/token If no Tenant ID is provided the `common` tenant will be used. The `CallbackUrl` will default to the /auth/aad path, but it can be configured explicitly. In either case it must match what has been configured on Azure as a "REPLY URL". The following properties are not used. If any are configured a warning will be logged. This can be disabled with `LogConfigurationWarnings`. - `RedirectUrl` - `RequestTokenUrl`
Inheritance: ServiceStack.Auth.OAuthProvider
ファイルを表示 Open project: jfoshee/ServiceStack.Authentication.Aad Class Usage Examples

Public Properties

Property Type Description
Realm string

Public Methods

Method Description
AadAuthProvider ( IAppSettings appSettings ) : ServiceStack.Auth
AadAuthProvider ( string clientId, string clientSecret ) : ServiceStack.Auth
AadAuthProvider ( string clientId, string clientSecret, IAppSettings appSettings ) : ServiceStack.Auth
Authenticate ( IServiceBase authService, IAuthSession session, Authenticate request ) : object
LoadUserOAuthProvider ( IAuthSession authSession, IAuthTokens tokens ) : void
Logout ( IServiceBase service, Authenticate request ) : object
OnAuthenticated ( IServiceBase authService, IAuthSession session, IAuthTokens tokens, string>.Dictionary authInfo ) : IHttpResult
RedirectToMicrosoftLogout ( IServiceBase authService ) : IHttpResult

Returns a redirect result to a Microsoft logout page

Protected Methods

Method Description
GetReferrerUrl ( IServiceBase authService, IAuthSession session, Authenticate request = null ) : string
LoadUserAuthInfo ( ServiceStack.Auth.AuthUserSession userSession, IAuthTokens tokens, string>.Dictionary authInfo ) : void
RedirectDueToFailure ( IServiceBase authService, IAuthSession session, NameValueCollection errorInfo ) : IHttpResult

Private Methods

Method Description
AadAuthProvider ( ) : ServiceStack.Auth
FailAndLogError ( IAuthSession session, NameValueCollection errorInfo ) : void
HasError ( NameValueCollection info ) : bool
RequestAccessToken ( IServiceBase authService, IAuthSession session, string code, IAuthTokens tokens ) : IHttpResult
RequestCode ( IServiceBase authService, IAuthSession session, ServiceStack.Auth.AuthUserSession userSession, IAuthTokens tokens ) : object

Method Details

AadAuthProvider() public method

public AadAuthProvider ( IAppSettings appSettings ) : ServiceStack.Auth
appSettings IAppSettings
return ServiceStack.Auth

AadAuthProvider() public method

public AadAuthProvider ( string clientId, string clientSecret ) : ServiceStack.Auth
clientId string
clientSecret string
return ServiceStack.Auth

AadAuthProvider() public method

public AadAuthProvider ( string clientId, string clientSecret, IAppSettings appSettings ) : ServiceStack.Auth
clientId string
clientSecret string
appSettings IAppSettings
return ServiceStack.Auth

Authenticate() public method

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

GetReferrerUrl() protected method

protected GetReferrerUrl ( IServiceBase authService, IAuthSession session, Authenticate request = null ) : string
authService IServiceBase
session IAuthSession
request Authenticate
return string

LoadUserAuthInfo() protected method

protected LoadUserAuthInfo ( ServiceStack.Auth.AuthUserSession userSession, IAuthTokens tokens, string>.Dictionary authInfo ) : void
userSession ServiceStack.Auth.AuthUserSession
tokens IAuthTokens
authInfo string>.Dictionary
return void

LoadUserOAuthProvider() public method

public LoadUserOAuthProvider ( IAuthSession authSession, IAuthTokens tokens ) : void
authSession IAuthSession
tokens IAuthTokens
return void

Logout() public method

public Logout ( IServiceBase service, Authenticate request ) : object
service IServiceBase
request Authenticate
return object

OnAuthenticated() public method

public OnAuthenticated ( IServiceBase authService, IAuthSession session, IAuthTokens tokens, string>.Dictionary authInfo ) : IHttpResult
authService IServiceBase
session IAuthSession
tokens IAuthTokens
authInfo string>.Dictionary
return IHttpResult

RedirectDueToFailure() protected method

protected RedirectDueToFailure ( IServiceBase authService, IAuthSession session, NameValueCollection errorInfo ) : IHttpResult
authService IServiceBase
session IAuthSession
errorInfo System.Collections.Specialized.NameValueCollection
return IHttpResult

RedirectToMicrosoftLogout() public method

Returns a redirect result to a Microsoft logout page
public RedirectToMicrosoftLogout ( IServiceBase authService ) : IHttpResult
authService IServiceBase
return IHttpResult

Property Details

Realm public_oe static_oe property

public static string Realm
return string