Share via


OAuthWebSecurity Class

Manages security that uses OAuth authentication providers like Facebook, Twitter, LinkedIn, Windows Live and OpenID authentication providers like Google and Yahoo.

Inheritance Hierarchy

System.Object
  Microsoft.Web.WebPages.OAuth.OAuthWebSecurity

Namespace:  Microsoft.Web.WebPages.OAuth
Assembly:  Microsoft.Web.WebPages.OAuth (in Microsoft.Web.WebPages.OAuth.dll)

Syntax

'Declaration
Public NotInheritable Class OAuthWebSecurity
'Usage
public static class OAuthWebSecurity
public ref class OAuthWebSecurity abstract sealed
[<AbstractClassAttribute>]
[<SealedAttribute>]
type OAuthWebSecurity =  class end
public final class OAuthWebSecurity

The OAuthWebSecurity type exposes the following members.

Properties

  Name Description
Public propertyStatic member IsAuthenticatedWithOAuth Gets a value that indicates whether the user has been authenticated using OAuth.
Public propertyStatic member RegisteredClientData Gets a collection of registered client data.

Top

Methods

  Name Description
Public methodStatic member CreateOrUpdateAccount Creates or updates the account using the specified provider and user ID for the provider ID and associate the new account with the specified user name.
Public methodStatic member DeleteAccount Deletes the specified membership account.
Public methodStatic member GetAccountsFromUserName Gets the account or accounts that are associated using the specified user name.
Public methodStatic member GetOAuthClientData Returns an OAuth authentication client data with the specified provider.
Public methodStatic member GetUserName Returns the user ID for the specified OAuth or OpenID provider and provider user ID.
Public methodStatic member HasLocalAccount Indicates whether the user has local account.
Public methodStatic member Login Logs the user in.
Public methodStatic member RegisterClient(IAuthenticationClient) Registers an OAuth authentication client.
Public methodStatic member RegisterClient(IAuthenticationClient, String, IDictionary<String, Object>) Registers an OAuth authentication client.
Public methodStatic member RegisterFacebookClient(String, String) Registers a Facebook client with a specified identifier.
Public methodStatic member RegisterFacebookClient(String, String, String) Registers a Facebook client with a specified identifier.
Public methodStatic member RegisterFacebookClient(String, String, String, IDictionary<String, Object>) Registers a Facebook client with a specified identifier.
Public methodStatic member RegisterGoogleClient() Registers a Google client.
Public methodStatic member RegisterGoogleClient(String) Registers a Google client.
Public methodStatic member RegisterGoogleClient(String, IDictionary<String, Object>) Registers a Google client.
Public methodStatic member RegisterLinkedInClient(String, String) Registers a LinkedIn client with a specified consumer key.
Public methodStatic member RegisterLinkedInClient(String, String, String) Registers a LinkedIn client with a specified consumer key.
Public methodStatic member RegisterLinkedInClient(String, String, String, IDictionary<String, Object>) Registers a LinkedIn client with a specified consumer key.
Public methodStatic member RegisterMicrosoftClient(String, String) Registers a Microsoft client with the specified identifier.
Public methodStatic member RegisterMicrosoftClient(String, String, String) Registers a Microsoft client with the specified identifier.
Public methodStatic member RegisterMicrosoftClient(String, String, String, IDictionary<String, Object>) Registers a Microsoft client with the specified identifier.
Public methodStatic member RegisterTwitterClient(String, String) Registers a Twitter client using the specified consumer key.
Public methodStatic member RegisterTwitterClient(String, String, String) Registers a Twitter client using the specified consumer key.
Public methodStatic member RegisterTwitterClient(String, String, String, IDictionary<String, Object>) Registers a Twitter client using the specified consumer key.
Public methodStatic member RegisterYahooClient() Registers a Yahoo client.
Public methodStatic member RegisterYahooClient(String) Registers a Yahoo client.
Public methodStatic member RegisterYahooClient(String, IDictionary<String, Object>) Registers a Yahoo client.
Public methodStatic member RequestAuthentication(String) Requests the specified provider to start the authentication by directing users to an external website.
Public methodStatic member RequestAuthentication(String, String) Requests the specified provider to start the authentication by directing users to an external website, and directs the provider to redirect the user to the specified URL when authentication is successful.
Public methodStatic member SerializeProviderUserId Serializes a user ID of the provider.
Public methodStatic member TryDeserializeProviderUserId Indicates whether the user ID of the provider deserialized.
Public methodStatic member TryGetOAuthClientData Indicates whether the provider gets an OAuth client data.
Public methodStatic member VerifyAuthentication() Returns a value that indicates whether the user account has been confirmed by the provider.
Public methodStatic member VerifyAuthentication(String) Returns a value that indicates whether the user account has been confirmed by the provider.

Top

Remarks

This class simplifies the task of letting users log in to your website using their credentials from another site, like Facebook or Yahoo. You can enable logins from those providers and then manage security in your site in much the same way that you do using the built-in membership provider.

For an example of using the OAuthWebSecurity class, see Using OAuth Providers with MVC 4.

Note

The classes in this namespace interact with the classes from the open-source DotNetOpenAuth library. The DotNetOpenAuth library has its own documentation at http://docs.dotnetopenauth.net/master/.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Web.WebPages.OAuth Namespace