C# Class nonintanon.Security.OAuth.OAuthWebSecurity

Contains APIs to manage authentication against OAuth & OpenID service providers
Exibir arquivo Open project: nonintanon/SimpleGuidMembershipProvider

Public Methods

Method Description
CreateOrUpdateAccount ( string providerName, string providerUserId, string userName ) : void

Creates or update the account with the specified provider, provider user id and associate it with the specified user name.

DeleteAccount ( string providerName, string providerUserId ) : bool

Delete the specified OAuth & OpenID account

GetAccountsFromUserName ( string userName ) : ICollection

Gets all OAuth & OpenID accounts which are associted with the specified user name.

GetOAuthClientData ( string providerName ) : Microsoft.Web.WebPages.OAuth.AuthenticationClientData

Gets the OAuth client data of the specified provider name.

GetUserName ( string providerName, string providerUserId ) : string

Gets the registered user name corresponding to the specified provider and provider user id.

HasLocalAccount ( System.Guid userId ) : bool

Determines whether there exists a local account (as opposed to OAuth account) with the specified userId.

RegisterFacebookClient ( string appId, string appSecret ) : void

Registers the Facebook client.

RegisterFacebookClient ( string appId, string appSecret, string displayName ) : void

Registers the Facebook client.

RegisterFacebookClient ( string appId, string appSecret, string displayName, object>.IDictionary extraData ) : void

Registers the Facebook client.

RegisterGoogleClient ( ) : void

Registers the Google client.

RegisterGoogleClient ( string displayName ) : void

Registers the Google client.

RegisterGoogleClient ( string displayName, object>.IDictionary extraData ) : void

Registers the Google client.

RegisterLinkedInClient ( string consumerKey, string consumerSecret ) : void

Registers the LinkedIn client.

RegisterLinkedInClient ( string consumerKey, string consumerSecret, string displayName ) : void

Registers the LinkedIn client.

RegisterLinkedInClient ( string consumerKey, string consumerSecret, string displayName, object>.IDictionary extraData ) : void

Registers the LinkedIn client.

RegisterMicrosoftClient ( string clientId, string clientSecret ) : void

Registers the Microsoft account client.

RegisterMicrosoftClient ( string clientId, string clientSecret, string displayName ) : void

Registers the Microsoft account client.

RegisterMicrosoftClient ( string clientId, string clientSecret, string displayName, object>.IDictionary extraData ) : void

Registers the Microsoft account client.

RegisterTwitterClient ( string consumerKey, string consumerSecret ) : void

Registers the Twitter client.

RegisterTwitterClient ( string consumerKey, string consumerSecret, string displayName ) : void

Registers the Twitter client.

RegisterTwitterClient ( string consumerKey, string consumerSecret, string displayName, object>.IDictionary extraData ) : void

Registers the Twitter client.

RegisterYahooClient ( ) : void

Registers the Yahoo client.

RegisterYahooClient ( string displayName ) : void

Registers the Yahoo client.

RegisterYahooClient ( string displayName, object>.IDictionary extraData ) : void

Registers the Yahoo client.

RequestAuthentication ( string provider ) : void

Requests the specified provider to start the authentication by directing users to an external website

SerializeProviderUserId ( string providerName, string providerUserId ) : string

Securely serializes a providerName/providerUserId pair.

Do not persist the return value to permanent storage. This implementation is subject to change.

TryGetOAuthClientData ( string providerName, AuthenticationClientData &clientData ) : bool

Tries getting the OAuth client data of the specified provider name.

Private Methods

Method Description
ClearProviders ( ) : void

for unit tests

GetIsAuthenticatedWithOAuthCore ( System.Web.HttpContextBase context ) : bool
GetOAuthClient ( string providerName ) : IAuthenticationClient
Login ( string providerName, string providerUserId, bool createPersistentCookie ) : bool
LoginCore ( System.Web.HttpContextBase context, string providerName, string providerUserId, bool createPersistentCookie ) : bool
RegisterClient ( IAuthenticationClient client ) : void
RegisterClient ( IAuthenticationClient client, string displayName, object>.IDictionary extraData ) : void
RequestAuthentication ( string provider, string returnUrl ) : void
RequestAuthenticationCore ( HttpContextBase context, string provider, string returnUrl ) : void

Requests the authentication core.

TryDeserializeProviderUserId ( string data, string &providerName, string &providerUserId ) : bool
TryGetOAuthClient ( string provider, IAuthenticationClient &client ) : bool
VerifyAuthentication ( ) : AuthenticationResult
VerifyAuthentication ( string returnUrl ) : AuthenticationResult
VerifyAuthenticationCore ( HttpContextBase context, string returnUrl ) : AuthenticationResult
VerifyProvider ( ) : GuidExtendedMembershipProvider

Method Details

CreateOrUpdateAccount() public static method

Creates or update the account with the specified provider, provider user id and associate it with the specified user name.
public static CreateOrUpdateAccount ( string providerName, string providerUserId, string userName ) : void
providerName string Name of the provider.
providerUserId string The provider user id.
userName string The user name.
return void

DeleteAccount() public static method

Delete the specified OAuth & OpenID account
public static DeleteAccount ( string providerName, string providerUserId ) : bool
providerName string Name of the provider.
providerUserId string The provider user id.
return bool

GetAccountsFromUserName() public static method

Gets all OAuth & OpenID accounts which are associted with the specified user name.
public static GetAccountsFromUserName ( string userName ) : ICollection
userName string The user name.
return ICollection

GetOAuthClientData() public static method

Gets the OAuth client data of the specified provider name.
public static GetOAuthClientData ( string providerName ) : Microsoft.Web.WebPages.OAuth.AuthenticationClientData
providerName string Name of the provider.
return Microsoft.Web.WebPages.OAuth.AuthenticationClientData

GetUserName() public static method

Gets the registered user name corresponding to the specified provider and provider user id.
public static GetUserName ( string providerName, string providerUserId ) : string
providerName string Name of the provider.
providerUserId string The provider user id.
return string

HasLocalAccount() public static method

Determines whether there exists a local account (as opposed to OAuth account) with the specified userId.
public static HasLocalAccount ( System.Guid userId ) : bool
userId System.Guid The user id to check for local account.
return bool

RegisterFacebookClient() public static method

Registers the Facebook client.
public static RegisterFacebookClient ( string appId, string appSecret ) : void
appId string The app id.
appSecret string The app secret.
return void

RegisterFacebookClient() public static method

Registers the Facebook client.
public static RegisterFacebookClient ( string appId, string appSecret, string displayName ) : void
appId string The app id.
appSecret string The app secret.
displayName string The display name of the client.
return void

RegisterFacebookClient() public static method

Registers the Facebook client.
public static RegisterFacebookClient ( string appId, string appSecret, string displayName, object>.IDictionary extraData ) : void
appId string The app id.
appSecret string The app secret.
displayName string The display name.
extraData object>.IDictionary The data bag used to store extra data about this client
return void

RegisterGoogleClient() public static method

Registers the Google client.
public static RegisterGoogleClient ( ) : void
return void

RegisterGoogleClient() public static method

Registers the Google client.
public static RegisterGoogleClient ( string displayName ) : void
displayName string The display name.
return void

RegisterGoogleClient() public static method

Registers the Google client.
public static RegisterGoogleClient ( string displayName, object>.IDictionary extraData ) : void
displayName string The display name.
extraData object>.IDictionary The data bag.
return void

RegisterLinkedInClient() public static method

Registers the LinkedIn client.
public static RegisterLinkedInClient ( string consumerKey, string consumerSecret ) : void
consumerKey string The consumer key.
consumerSecret string The consumer secret.
return void

RegisterLinkedInClient() public static method

Registers the LinkedIn client.
public static RegisterLinkedInClient ( string consumerKey, string consumerSecret, string displayName ) : void
consumerKey string The consumer key.
consumerSecret string The consumer secret.
displayName string The display name.
return void

RegisterLinkedInClient() public static method

Registers the LinkedIn client.
public static RegisterLinkedInClient ( string consumerKey, string consumerSecret, string displayName, object>.IDictionary extraData ) : void
consumerKey string The consumer key.
consumerSecret string The consumer secret.
displayName string The display name.
extraData object>.IDictionary The data bag used to store extra data about this client
return void

RegisterMicrosoftClient() public static method

Registers the Microsoft account client.
public static RegisterMicrosoftClient ( string clientId, string clientSecret ) : void
clientId string The client id.
clientSecret string The client secret.
return void

RegisterMicrosoftClient() public static method

Registers the Microsoft account client.
public static RegisterMicrosoftClient ( string clientId, string clientSecret, string displayName ) : void
clientId string The client id.
clientSecret string The client secret.
displayName string The display name.
return void

RegisterMicrosoftClient() public static method

Registers the Microsoft account client.
public static RegisterMicrosoftClient ( string clientId, string clientSecret, string displayName, object>.IDictionary extraData ) : void
clientId string The client id.
clientSecret string The client secret.
displayName string The display name.
extraData object>.IDictionary The data bag used to store extra data about this client
return void

RegisterTwitterClient() public static method

Registers the Twitter client.
public static RegisterTwitterClient ( string consumerKey, string consumerSecret ) : void
consumerKey string The consumer key.
consumerSecret string The consumer secret.
return void

RegisterTwitterClient() public static method

Registers the Twitter client.
public static RegisterTwitterClient ( string consumerKey, string consumerSecret, string displayName ) : void
consumerKey string The consumer key.
consumerSecret string The consumer secret.
displayName string The display name.
return void

RegisterTwitterClient() public static method

Registers the Twitter client.
public static RegisterTwitterClient ( string consumerKey, string consumerSecret, string displayName, object>.IDictionary extraData ) : void
consumerKey string The consumer key.
consumerSecret string The consumer secret.
displayName string The display name.
extraData object>.IDictionary The data bag used to store extra data about this client
return void

RegisterYahooClient() public static method

Registers the Yahoo client.
public static RegisterYahooClient ( ) : void
return void

RegisterYahooClient() public static method

Registers the Yahoo client.
public static RegisterYahooClient ( string displayName ) : void
displayName string The display name.
return void

RegisterYahooClient() public static method

Registers the Yahoo client.
public static RegisterYahooClient ( string displayName, object>.IDictionary extraData ) : void
displayName string The display name.
extraData object>.IDictionary The data bag.
return void

RequestAuthentication() public static method

Requests the specified provider to start the authentication by directing users to an external website
public static RequestAuthentication ( string provider ) : void
provider string The provider.
return void

SerializeProviderUserId() public static method

Securely serializes a providerName/providerUserId pair.
Do not persist the return value to permanent storage. This implementation is subject to change.
public static SerializeProviderUserId ( string providerName, string providerUserId ) : string
providerName string The provider name.
providerUserId string The provider-specific user id.
return string

TryGetOAuthClientData() public static method

Tries getting the OAuth client data of the specified provider name.
public static TryGetOAuthClientData ( string providerName, AuthenticationClientData &clientData ) : bool
providerName string Name of the provider.
clientData AuthenticationClientData The client data of the specified provider name.
return bool