// // disable StyleCop on this file //----------------------------------------------------------------------- // // Copyright (c) Andrew Arnott. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.OAuthWrap { using System; using System.Collections.Generic; /// /// An enumeration of the OAuth WRAP protocol versions supported by this library. /// public enum ProtocolVersion { /// /// The OAuth 2.0 specification. /// V20, } /// /// Protocol constants for OAuth WRAP. /// internal class Protocol { /// /// The HTTP authorization scheme "Token"; /// internal const string HttpAuthorizationScheme = "Token"; /// /// The format of the HTTP Authorization header value that authorizes OAuth WRAP requests. /// internal const string HttpAuthorizationHeaderFormat = "Token token=\"{0}\""; /// /// The "type" string. /// internal const string type = "type"; /// /// The "state" string. /// internal const string state = "state"; /// /// The "redirect_uri_mismatch" string. /// internal const string redirect_uri_mismatch = "redirect_uri_mismatch"; /// /// The "bad_verification_code" string. /// internal const string bad_verification_code = "bad_verification_code"; /// /// The "incorrect_client_credentials" string. /// internal const string incorrect_client_credentials = "incorrect_client_credentials"; /// /// The "redirect_uri" string. /// internal const string redirect_uri = "redirect_uri"; /// /// The "client_id" string. /// internal const string client_id = "client_id"; /// /// The "scope" string. /// internal const string scope = "scope"; /// /// The "immediate" string. /// internal const string immediate = "immediate"; /// /// The "client_secret" string. /// internal const string client_secret = "client_secret"; /// /// The "wrap_verification_code" string. /// internal const string code = "code"; /// /// The "user_code" string. /// internal const string user_code = "user_code"; /// /// The "user_uri" string. /// internal const string user_uri = "user_uri"; /// /// The "interval" string. /// internal const string interval = "interval"; /// /// The "wrap_verification_url" string. /// internal const string wrap_verification_url = "wrap_verification_url"; /// /// The "error" string. /// internal const string error = "error"; /// /// The "access_token" string. /// internal const string access_token = "access_token"; /// /// The "access_token_secret" string. /// internal const string access_token_secret = "access_token_secret"; /// /// The "refresh_token" string. /// internal const string refresh_token = "refresh_token"; /// /// The "expires_in" string. /// internal const string expires_in = "expires_in"; /// /// The "expired_delegation_code" string. /// internal const string expired_delegation_code = "expired_delegation_code"; /// /// The "wrap_username" string. /// internal const string wrap_username = "wrap_username"; /// /// The "wrap_password" string. /// internal const string wrap_password = "wrap_password"; /// /// The "wrap_name" string. /// internal const string wrap_name = "wrap_name"; /// /// The "format" string. /// internal const string format = "format"; /// /// The "assertion" string. /// internal const string assertion = "assertion"; /// /// The "wrap_SAML" string. /// internal const string wrap_saml = "wrap_SAML"; /// /// The "wrap_SWT" string. /// internal const string wrap_swt = "wrap_SWT"; /// /// The "wrap_captcha_url" string. /// internal const string wrap_captcha_url = "wrap_captcha_url"; /// /// The "wrap_captcha_solution" string. /// internal const string wrap_captcha_solution = "wrap_captcha_solution"; /// /// The "user_denied" string. /// internal const string user_denied = "user_denied"; /// /// The "secret_type" string. /// internal const string secret_type = "secret_type"; /// /// Gets the instance with values initialized for V1.0 of the protocol. /// internal static readonly Protocol V20 = new Protocol { Version = new Version(2, 0), ProtocolVersion = ProtocolVersion.V20, }; /// /// A list of all supported OAuth versions, in order starting from newest version. /// internal static readonly List AllVersions = new List() { V20 }; /// /// The default (or most recent) supported version of the OpenID protocol. /// internal static readonly Protocol Default = AllVersions[0]; /// /// Gets or sets the OAuth WRAP version represented by this instance. /// /// The version. internal Version Version { get; private set; } /// /// Gets or sets the OAuth WRAP version represented by this instance. /// /// The protocol version. internal ProtocolVersion ProtocolVersion { get; private set; } /// /// Gets the OAuth Protocol instance to use for the given version. /// /// The OAuth version to get. /// A matching instance. public static Protocol Lookup(ProtocolVersion version) { switch (version) { case ProtocolVersion.V20: return Protocol.V20; default: throw new ArgumentOutOfRangeException("version"); } } internal static class ResponseFormats { internal const string Json = "json"; internal const string Xml = "xml"; internal const string Form = "form"; } } }