C# Class nonintanon.Security.OAuth.OAuthWebSecurity

Contains APIs to manage authentication against OAuth & OpenID service providers
Afficher le fichier Open project: nonintanon/SimpleGuidMembershipProvider

Méthodes publiques

Méthode 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

Méthode 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 méthode

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.
Résultat void

DeleteAccount() public static méthode

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.
Résultat bool

GetAccountsFromUserName() public static méthode

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

GetOAuthClientData() public static méthode

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.
Résultat Microsoft.Web.WebPages.OAuth.AuthenticationClientData

GetUserName() public static méthode

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.
Résultat string

HasLocalAccount() public static méthode

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.
Résultat bool

RegisterFacebookClient() public static méthode

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

RegisterFacebookClient() public static méthode

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.
Résultat void

RegisterFacebookClient() public static méthode

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
Résultat void

RegisterGoogleClient() public static méthode

Registers the Google client.
public static RegisterGoogleClient ( ) : void
Résultat void

RegisterGoogleClient() public static méthode

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

RegisterGoogleClient() public static méthode

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

RegisterLinkedInClient() public static méthode

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

RegisterLinkedInClient() public static méthode

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.
Résultat void

RegisterLinkedInClient() public static méthode

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
Résultat void

RegisterMicrosoftClient() public static méthode

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

RegisterMicrosoftClient() public static méthode

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.
Résultat void

RegisterMicrosoftClient() public static méthode

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
Résultat void

RegisterTwitterClient() public static méthode

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

RegisterTwitterClient() public static méthode

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.
Résultat void

RegisterTwitterClient() public static méthode

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
Résultat void

RegisterYahooClient() public static méthode

Registers the Yahoo client.
public static RegisterYahooClient ( ) : void
Résultat void

RegisterYahooClient() public static méthode

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

RegisterYahooClient() public static méthode

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

RequestAuthentication() public static méthode

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.
Résultat void

SerializeProviderUserId() public static méthode

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.
Résultat string

TryGetOAuthClientData() public static méthode

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.
Résultat bool