Permalink
Browse files

Renamed enumeration values to follow C# conventions

  • Loading branch information...
1 parent 5fd910c commit 9d5c6d0deb10930a0378a16e430149a84b08b634 @bbaia bbaia committed Jan 12, 2012
View
2 examples/Common/Spring.Social.Facebook/Social/Facebook/Api/Impl/FacebookTemplate.cs
@@ -76,7 +76,7 @@ protected override IList<IHttpMessageConverter> GetMessageConverters()
protected override OAuth2Version GetOAuth2Version()
{
- return OAuth2Version.DRAFT_10;
+ return OAuth2Version.Draft10;
}
#region IFacebook Membres
View
2 examples/Common/Spring.Social.Github/Social/GitHub/Api/Impl/GitHubTemplate.cs
@@ -77,7 +77,7 @@ protected override IList<IHttpMessageConverter> GetMessageConverters()
protected override OAuth2Version GetOAuth2Version()
{
- return OAuth2Version.DRAFT_8;
+ return OAuth2Version.Draft8;
}
#region GitHub Membres
View
2 examples/Spring.OAuth2ConsoleQuickStart/src/Spring.OAuth2ConsoleQuickStart/Program.cs
@@ -27,7 +27,7 @@ static void Main(string[] args)
RedirectUrl = "https://www.facebook.com/connect/login_success.html",
Scope = "offline_access,publish_stream"
};
- string authorizationUrl = facebookServiceProvider.OAuthOperations.BuildAuthorizeUrl(GrantType.IMPLICIT_GRANT, parameters);
+ string authorizationUrl = facebookServiceProvider.OAuthOperations.BuildAuthorizeUrl(GrantType.ImplicitGrant, parameters);
Console.WriteLine("Redirect user to Facebook for authorization: " + authorizationUrl);
Process.Start(authorizationUrl);
View
2 ...s/Spring.OAuth2MvcQuickStart/Spring.OAuth2MvcQuickStart/Controllers/FacebookController.cs
@@ -34,7 +34,7 @@ public ActionResult SignIn()
RedirectUrl = "http://localhost/Facebook/Callback",
Scope = "publish_stream"
};
- return Redirect(facebookProvider.OAuthOperations.BuildAuthorizeUrl(GrantType.AUTHORIZATION_CODE, parameters));
+ return Redirect(facebookProvider.OAuthOperations.BuildAuthorizeUrl(GrantType.AuthorizationCode, parameters));
}
// GET: /Facebook/Callback
View
2 ...WindowsPhoneQuickStart/Spring.OAuth2WindowsPhoneQuickStart/ViewModel/FacebookViewModel.cs
@@ -57,7 +57,7 @@ public void Authenticate()
RedirectUrl = CallbackUrl,
Scope = "publish_stream"
};
- this.AuthenticateUri = new Uri(this.FacebookServiceProvider.OAuthOperations.BuildAuthenticateUrl(GrantType.AUTHORIZATION_CODE, parameters));
+ this.AuthenticateUri = new Uri(this.FacebookServiceProvider.OAuthOperations.BuildAuthenticateUrl(GrantType.AuthorizationCode, parameters));
}
public void AuthenticateCallback(string code)
View
16 src/Spring.Social.Core/Social/OAuth1/OAuth1Template.cs
@@ -71,7 +71,7 @@ public RestTemplate RestTemplate
/// <param name="authorizeUrl">The authorize URL.</param>
/// <param name="accessTokenUrl">The access token URL.</param>
public OAuth1Template(string consumerKey, string consumerSecret, string requestTokenUrl, string authorizeUrl, string accessTokenUrl)
- : this(consumerKey, consumerSecret, requestTokenUrl, authorizeUrl, accessTokenUrl, OAuth1Version.CORE_10_REVISION_A)
+ : this(consumerKey, consumerSecret, requestTokenUrl, authorizeUrl, accessTokenUrl, OAuth1Version.Core10a)
{
}
@@ -99,7 +99,7 @@ public OAuth1Template(string consumerKey, string consumerSecret, string requestT
/// <param name="authenticateUrl">The authenticate URL.</param>
/// <param name="accessTokenUrl">The access token URL.</param>
public OAuth1Template(string consumerKey, string consumerSecret, string requestTokenUrl, string authorizeUrl, string authenticateUrl, string accessTokenUrl)
- : this(consumerKey, consumerSecret, requestTokenUrl, authorizeUrl, authenticateUrl, accessTokenUrl, OAuth1Version.CORE_10_REVISION_A)
+ : this(consumerKey, consumerSecret, requestTokenUrl, authorizeUrl, authenticateUrl, accessTokenUrl, OAuth1Version.Core10a)
{
}
@@ -194,7 +194,7 @@ public string BuildAuthenticateUrl(string requestToken, OAuth1Parameters paramet
public Task<OAuthToken> FetchRequestTokenAsync(string callbackUrl, NameValueCollection additionalParameters)
{
IDictionary<string, string> oauthParameters = new Dictionary<string, string>(1);
- if (version == OAuth1Version.CORE_10_REVISION_A)
+ if (version == OAuth1Version.Core10a)
{
oauthParameters.Add("oauth_callback", callbackUrl);
}
@@ -222,7 +222,7 @@ public Task<OAuthToken> ExchangeForAccessTokenAsync(AuthorizedRequestToken reque
{
IDictionary<string, string> tokenParameters = new Dictionary<string, string>(2);
tokenParameters.Add("oauth_token", requestToken.Value);
- if (version == OAuth1Version.CORE_10_REVISION_A)
+ if (version == OAuth1Version.Core10a)
{
tokenParameters.Add("oauth_verifier", requestToken.Verifier);
}
@@ -252,7 +252,7 @@ public Task<OAuthToken> ExchangeForAccessTokenAsync(AuthorizedRequestToken reque
public OAuthToken FetchRequestToken(string callbackUrl, NameValueCollection additionalParameters)
{
IDictionary<string, string> oauthParameters = new Dictionary<string, string>(1);
- if (version == OAuth1Version.CORE_10_REVISION_A)
+ if (version == OAuth1Version.Core10a)
{
oauthParameters.Add("oauth_callback", callbackUrl);
}
@@ -275,7 +275,7 @@ public OAuthToken ExchangeForAccessToken(AuthorizedRequestToken requestToken, Na
{
IDictionary<string, string> tokenParameters = new Dictionary<string, string>(2);
tokenParameters.Add("oauth_token", requestToken.Value);
- if (version == OAuth1Version.CORE_10_REVISION_A)
+ if (version == OAuth1Version.Core10a)
{
tokenParameters.Add("oauth_verifier", requestToken.Verifier);
}
@@ -307,7 +307,7 @@ public OAuthToken ExchangeForAccessToken(AuthorizedRequestToken requestToken, Na
public RestOperationCanceler FetchRequestTokenAsync(string callbackUrl, NameValueCollection additionalParameters, Action<RestOperationCompletedEventArgs<OAuthToken>> operationCompleted)
{
IDictionary<string, string> oauthParameters = new Dictionary<string, string>(1);
- if (version == OAuth1Version.CORE_10_REVISION_A)
+ if (version == OAuth1Version.Core10a)
{
oauthParameters.Add("oauth_callback", callbackUrl);
}
@@ -347,7 +347,7 @@ public RestOperationCanceler ExchangeForAccessTokenAsync(AuthorizedRequestToken
{
IDictionary<string, string> tokenParameters = new Dictionary<string, string>(2);
tokenParameters.Add("oauth_token", requestToken.Value);
- if (version == OAuth1Version.CORE_10_REVISION_A)
+ if (version == OAuth1Version.Core10a)
{
tokenParameters.Add("oauth_verifier", requestToken.Verifier);
}
View
4 src/Spring.Social.Core/Social/OAuth1/OAuth1Version.cs
@@ -35,11 +35,11 @@ public enum OAuth1Version
/// <summary>
/// OAuth Core Version 1.0.
/// </summary>
- CORE_10,
+ Core10,
/// <summary>
/// OAuth Core Version 1.0 Revision A.
/// </summary>
- CORE_10_REVISION_A
+ Core10a
}
}
View
4 src/Spring.Social.Core/Social/OAuth2/AbstractOAuth2ApiBinding.cs
@@ -105,12 +105,12 @@ public bool IsAuthorized
/// Subclasses may override to return another version.
/// </remarks>
/// <returns>
- /// By default, returns OAuth2Version.BEARER indicating versions of OAuth2 that apply the bearer token scheme.
+ /// By default, returns OAuth2Version.Bearer indicating versions of OAuth2 that apply the bearer token scheme.
/// </returns>
/// <see cref="OAuth2Version"/>
protected virtual OAuth2Version GetOAuth2Version()
{
- return OAuth2Version.BEARER;
+ return OAuth2Version.Bearer;
}
/// <summary>
View
8 src/Spring.Social.Core/Social/OAuth2/GrantType .cs
@@ -29,15 +29,15 @@ namespace Spring.Social.OAuth2
public enum GrantType
{
/// <summary>
- /// AUTHORIZATION_CODE denotes the server-side authorization flow, and is
+ /// Denotes the server-side authorization flow, and is
/// associated with the response_type=code parameter value.
/// </summary>
- AUTHORIZATION_CODE,
+ AuthorizationCode,
/// <summary>
- /// IMPLICIT_GRANT denotes the client-side authorization flow and is
+ /// Denotes the client-side authorization flow and is
/// associated with the response_type=token parameter value.
/// </summary>
- IMPLICIT_GRANT
+ ImplicitGrant
}
}
View
6 src/Spring.Social.Core/Social/OAuth2/OAuth2RequestInterceptor.cs
@@ -58,13 +58,13 @@ public void BeforeExecute(IClientHttpRequestContext request)
{
switch (this.oauth2Version)
{
- case OAuth2Version.BEARER:
+ case OAuth2Version.Bearer:
request.Headers["Authorization"] = "Bearer " + accessToken;
break;
- case OAuth2Version.DRAFT_10:
+ case OAuth2Version.Draft10:
request.Headers["Authorization"] = "OAuth " + accessToken;
break;
- case OAuth2Version.DRAFT_8:
+ case OAuth2Version.Draft8:
request.Headers["Authorization"] = "Token token=\"" + accessToken + "\"";
break;
}
View
4 src/Spring.Social.Core/Social/OAuth2/OAuth2Template.cs
@@ -469,11 +469,11 @@ private AccessGrant ExtractAccessGrant(JsonValue response)
private static string BuildAuthUrl(string baseAuthUrl, GrantType grantType, OAuth2Parameters parameters)
{
StringBuilder authUrl = new StringBuilder(baseAuthUrl);
- if (grantType == GrantType.AUTHORIZATION_CODE)
+ if (grantType == GrantType.AuthorizationCode)
{
authUrl.Append("&response_type=code");
}
- else if (grantType == GrantType.IMPLICIT_GRANT)
+ else if (grantType == GrantType.ImplicitGrant)
{
authUrl.Append("&response_type=token");
}
View
6 src/Spring.Social.Core/Social/OAuth2/OAuth2Version.cs
@@ -36,16 +36,16 @@ public enum OAuth2Version
/// <summary>
/// OAuth Version 2.0 using bearer tokens (since Draft 12).
/// </summary>
- BEARER,
+ Bearer,
/// <summary>
/// OAuth Version 2.0 Draft 10.
/// </summary>
- DRAFT_10,
+ Draft10,
/// <summary>
/// OAuth Version 2.0 Draft 8.
/// </summary>
- DRAFT_8
+ Draft8
}
}
View
6 test/Spring.Social.Core.Tests/Social/OAuth1/OAuth1TemplateTests.cs
@@ -49,9 +49,9 @@ public class OAuth1TemplateTests
[SetUp]
public void Setup()
{
- oauth10a = new OAuth1Template("consumer_key", "consumer_secret", REQUEST_TOKEN_URL, AUTHORIZE_URL, null, ACCESS_TOKEN_URL, OAuth1Version.CORE_10_REVISION_A);
- oauth10 = new OAuth1Template("consumer_key", "consumer_secret", REQUEST_TOKEN_URL, AUTHORIZE_URL, AUTHENTICATE_URL, ACCESS_TOKEN_URL, OAuth1Version.CORE_10);
- customOauth10 = new CustomOAuth1Template("consumer_key", "consumer_secret", REQUEST_TOKEN_URL, AUTHORIZE_URL, null, ACCESS_TOKEN_URL, OAuth1Version.CORE_10);
+ oauth10a = new OAuth1Template("consumer_key", "consumer_secret", REQUEST_TOKEN_URL, AUTHORIZE_URL, null, ACCESS_TOKEN_URL, OAuth1Version.Core10a);
+ oauth10 = new OAuth1Template("consumer_key", "consumer_secret", REQUEST_TOKEN_URL, AUTHORIZE_URL, AUTHENTICATE_URL, ACCESS_TOKEN_URL, OAuth1Version.Core10);
+ customOauth10 = new CustomOAuth1Template("consumer_key", "consumer_secret", REQUEST_TOKEN_URL, AUTHORIZE_URL, null, ACCESS_TOKEN_URL, OAuth1Version.Core10);
}
[Test]
View
6 test/Spring.Social.Core.Tests/Social/OAuth2/AbstractOAuth2ApiBindingTests.cs
@@ -36,7 +36,7 @@ public class AbstractOAuth2ApiBindingTests : AbstractOAuth2ApiBinding
{
#region AbstractOAuth2ApiBinding implementation
- public static OAuth2Version OAuth2Version = OAuth2Version.BEARER;
+ public static OAuth2Version OAuth2Version = OAuth2Version.Bearer;
public AbstractOAuth2ApiBindingTests()
: base()
@@ -87,7 +87,7 @@ public void RequestInterceptor()
[Test]
public void RequestInterceptor_Draft10()
{
- AbstractOAuth2ApiBindingTests.OAuth2Version = OAuth2Version.DRAFT_10;
+ AbstractOAuth2ApiBindingTests.OAuth2Version = OAuth2Version.Draft10;
AbstractOAuth2ApiBindingTests apiBinding = new AbstractOAuth2ApiBindingTests("access_token");
AssertThatRequestInterceptorWritesAuthorizationHeader(apiBinding, "OAuth access_token");
apiBinding.UpdateStatus();
@@ -96,7 +96,7 @@ public void RequestInterceptor_Draft10()
[Test]
public void RequestInterceptor_Draft8()
{
- AbstractOAuth2ApiBindingTests.OAuth2Version = OAuth2Version.DRAFT_8;
+ AbstractOAuth2ApiBindingTests.OAuth2Version = OAuth2Version.Draft8;
AbstractOAuth2ApiBindingTests apiBinding = new AbstractOAuth2ApiBindingTests("access_token");
AssertThatRequestInterceptorWritesAuthorizationHeader(apiBinding, "Token token=\"access_token\"");
apiBinding.UpdateStatus();
View
8 test/Spring.Social.Core.Tests/Social/OAuth2/OAuth2TemplateTests.cs
@@ -56,7 +56,7 @@ public void BuildAuthorizeUrl_CodeResponseType()
parameters.RedirectUrl = "http://www.someclient.com/connect/foo";
parameters.Scope = "read,write";
string expected = AUTHORIZE_URL + "?client_id=client_id&response_type=code&redirect_uri=http%3A%2F%2Fwww.someclient.com%2Fconnect%2Ffoo&scope=read%2Cwrite";
- string actual = oAuth2Template.BuildAuthorizeUrl(GrantType.AUTHORIZATION_CODE, parameters);
+ string actual = oAuth2Template.BuildAuthorizeUrl(GrantType.AuthorizationCode, parameters);
Assert.AreEqual(expected, actual);
}
@@ -67,7 +67,7 @@ public void BuildAuthorizeUrl_TokenResponseType()
parameters.RedirectUrl = "http://www.someclient.com/connect/foo";
parameters.Scope = "read,write";
string expected = AUTHORIZE_URL + "?client_id=client_id&response_type=token&redirect_uri=http%3A%2F%2Fwww.someclient.com%2Fconnect%2Ffoo&scope=read%2Cwrite";
- string actual = oAuth2Template.BuildAuthorizeUrl(GrantType.IMPLICIT_GRANT, parameters);
+ string actual = oAuth2Template.BuildAuthorizeUrl(GrantType.ImplicitGrant, parameters);
Assert.AreEqual(expected, actual);
}
@@ -77,7 +77,7 @@ public void BuildAuthorizeUrl_NoScopeInParameters()
OAuth2Parameters parameters = new OAuth2Parameters();
parameters.RedirectUrl = "http://www.someclient.com/connect/foo";
string expected = AUTHORIZE_URL + "?client_id=client_id&response_type=code&redirect_uri=http%3A%2F%2Fwww.someclient.com%2Fconnect%2Ffoo";
- string actual = oAuth2Template.BuildAuthorizeUrl(GrantType.AUTHORIZATION_CODE, parameters);
+ string actual = oAuth2Template.BuildAuthorizeUrl(GrantType.AuthorizationCode, parameters);
Assert.AreEqual(expected, actual);
}
@@ -91,7 +91,7 @@ public void BuildAuthorizeUrl_AdditionalParameters()
parameters.Add("anotherparam", "somevalue1");
parameters.Add("anotherparam", "somevalue2");
string expected = AUTHORIZE_URL + "?client_id=client_id&response_type=token&redirect_uri=http%3A%2F%2Fwww.someclient.com%2Fconnect%2Ffoo&scope=read%2Cwrite&display=touch&anotherparam=somevalue1&anotherparam=somevalue2";
- string actual = oAuth2Template.BuildAuthorizeUrl(GrantType.IMPLICIT_GRANT, parameters);
+ string actual = oAuth2Template.BuildAuthorizeUrl(GrantType.ImplicitGrant, parameters);
Assert.AreEqual(expected, actual);
}

0 comments on commit 9d5c6d0

Please sign in to comment.