Skip to content

Commit 4f46357

Browse files
khellangkevinchalet
authored andcommitted
Introduce new claims constants classes
1 parent 5ab0e52 commit 4f46357

File tree

50 files changed

+644
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+644
-84
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
3+
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
4+
* for more information concerning the license and the contributors participating to this project.
5+
*/
6+
7+
namespace AspNet.Security.OAuth.Autodesk
8+
{
9+
/// <summary>
10+
/// Contains constants specific to the <see cref="AutodeskAuthenticationHandler"/>.
11+
/// </summary>
12+
public static class AutodeskAuthenticationConstants
13+
{
14+
public static class Claims
15+
{
16+
public const string EmailVerified = "urn:autodesk:emailverified";
17+
public const string TwoFactorEnabled = "urn:autodesk:twofactorenabled";
18+
}
19+
}
20+
}

src/AspNet.Security.OAuth.Autodesk/AutodeskAuthenticationOptions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.AspNetCore.Authentication;
99
using Microsoft.AspNetCore.Authentication.OAuth;
1010
using Microsoft.AspNetCore.Http;
11+
using static AspNet.Security.OAuth.Autodesk.AutodeskAuthenticationConstants;
1112

1213
namespace AspNet.Security.OAuth.Autodesk
1314
{
@@ -32,8 +33,8 @@ public AutodeskAuthenticationOptions()
3233
ClaimActions.MapJsonKey(ClaimTypes.GivenName, "firstName");
3334
ClaimActions.MapJsonKey(ClaimTypes.Surname, "lastName");
3435
ClaimActions.MapJsonKey(ClaimTypes.Email, "emailId");
35-
ClaimActions.MapJsonKey("urn:autodesk:emailverified", "emailVerified");
36-
ClaimActions.MapJsonKey("urn:autodesk:twofactorenabled", "2FaEnabled");
36+
ClaimActions.MapJsonKey(Claims.EmailVerified, "emailVerified");
37+
ClaimActions.MapJsonKey(Claims.TwoFactorEnabled, "2FaEnabled");
3738
}
3839
}
3940
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
3+
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
4+
* for more information concerning the license and the contributors participating to this project.
5+
*/
6+
7+
namespace AspNet.Security.OAuth.Bitbucket
8+
{
9+
/// <summary>
10+
/// Contains constants specific to the <see cref="BitbucketAuthenticationHandler"/>.
11+
/// </summary>
12+
public static class BitbucketAuthenticationConstants
13+
{
14+
public static class Claims
15+
{
16+
public const string DisplayName = "urn:bitbucket:name";
17+
public const string Website = "urn:bitbucket:url";
18+
}
19+
}
20+
}

src/AspNet.Security.OAuth.Bitbucket/BitbucketAuthenticationOptions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.AspNetCore.Authentication;
99
using Microsoft.AspNetCore.Authentication.OAuth;
1010
using Microsoft.AspNetCore.Http;
11+
using static AspNet.Security.OAuth.Bitbucket.BitbucketAuthenticationConstants;
1112

1213
namespace AspNet.Security.OAuth.Bitbucket
1314
{
@@ -28,8 +29,8 @@ public BitbucketAuthenticationOptions()
2829
ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "account_id");
2930
ClaimActions.MapJsonKey(ClaimTypes.Name, "username");
3031
ClaimActions.MapJsonKey(ClaimTypes.Email, "email");
31-
ClaimActions.MapJsonKey("urn:bitbucket:name", "display_name");
32-
ClaimActions.MapJsonKey("urn:bitbucket:url", "website");
32+
ClaimActions.MapJsonKey(Claims.DisplayName, "display_name");
33+
ClaimActions.MapJsonKey(Claims.Website, "website");
3334
}
3435

3536
/// <summary>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
3+
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
4+
* for more information concerning the license and the contributors participating to this project.
5+
*/
6+
7+
namespace AspNet.Security.OAuth.DeviantArt
8+
{
9+
/// <summary>
10+
/// Contains constants specific to the <see cref="DeviantArtAuthenticationHandler"/>.
11+
/// </summary>
12+
public static class DeviantArtAuthenticationConstants
13+
{
14+
public static class Claims
15+
{
16+
public const string Username = "urn:deviantart:name";
17+
}
18+
}
19+
}

src/AspNet.Security.OAuth.DeviantArt/DeviantArtAuthenticationOptions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.AspNetCore.Authentication;
99
using Microsoft.AspNetCore.Authentication.OAuth;
1010
using Microsoft.AspNetCore.Http;
11+
using static AspNet.Security.OAuth.DeviantArt.DeviantArtAuthenticationConstants;
1112

1213
namespace AspNet.Security.OAuth.DeviantArt
1314
{
@@ -29,7 +30,7 @@ public DeviantArtAuthenticationOptions()
2930

3031
ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "userid");
3132
ClaimActions.MapJsonKey(ClaimTypes.Name, "username");
32-
ClaimActions.MapJsonKey("urn:DeviantArt:name", "username");
33+
ClaimActions.MapJsonKey(Claims.Username, "username");
3334
}
3435
}
3536
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
3+
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
4+
* for more information concerning the license and the contributors participating to this project.
5+
*/
6+
7+
namespace AspNet.Security.OAuth.EVEOnline
8+
{
9+
/// <summary>
10+
/// Contains constants specific to the <see cref="EVEOnlineAuthenticationHandler"/>.
11+
/// </summary>
12+
public static class EVEOnlineAuthenticationConstants
13+
{
14+
public static class Claims
15+
{
16+
public const string Scopes = "urn:eveonline:scopes";
17+
}
18+
}
19+
}

src/AspNet.Security.OAuth.EVEOnline/EVEOnlineAuthenticationOptions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.AspNetCore.Authentication;
1010
using Microsoft.AspNetCore.Authentication.OAuth;
1111
using Microsoft.AspNetCore.Http;
12+
using static AspNet.Security.OAuth.EVEOnline.EVEOnlineAuthenticationConstants;
1213

1314
namespace AspNet.Security.OAuth.EVEOnline
1415
{
@@ -27,7 +28,7 @@ public EVEOnlineAuthenticationOptions()
2728
ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "CharacterID");
2829
ClaimActions.MapJsonKey(ClaimTypes.Name, "CharacterName");
2930
ClaimActions.MapJsonKey(ClaimTypes.Expiration, "ExpiresOn");
30-
ClaimActions.MapJsonKey("urn:eveonline:scopes", "Scopes");
31+
ClaimActions.MapJsonKey(Claims.Scopes, "Scopes");
3132
}
3233

3334
/// <summary>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
3+
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
4+
* for more information concerning the license and the contributors participating to this project.
5+
*/
6+
7+
namespace AspNet.Security.OAuth.Fitbit
8+
{
9+
/// <summary>
10+
/// Contains constants specific to the <see cref="FitbitAuthenticationHandler"/>.
11+
/// </summary>
12+
public static class FitbitAuthenticationConstants
13+
{
14+
public static class Claims
15+
{
16+
public const string Avatar = "urn:fitbit:avatar";
17+
public const string Avatar150 = "urn:fitbit:avatar150";
18+
}
19+
}
20+
}

src/AspNet.Security.OAuth.Fitbit/FitbitAuthenticationOptions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.AspNetCore.Authentication;
99
using Microsoft.AspNetCore.Authentication.OAuth;
1010
using Microsoft.AspNetCore.Http;
11+
using static AspNet.Security.OAuth.Fitbit.FitbitAuthenticationConstants;
1112

1213
namespace AspNet.Security.OAuth.Fitbit
1314
{
@@ -29,8 +30,8 @@ public FitbitAuthenticationOptions()
2930

3031
ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "encodedId");
3132
ClaimActions.MapJsonKey(ClaimTypes.Name, "displayName");
32-
ClaimActions.MapJsonKey("urn:fitbit:avatar", "avatar");
33-
ClaimActions.MapJsonKey("urn:fitbit:avatar150", "avatar150");
33+
ClaimActions.MapJsonKey(Claims.Avatar, "avatar");
34+
ClaimActions.MapJsonKey(Claims.Avatar150, "avatar150");
3435
}
3536
}
3637
}

0 commit comments

Comments
 (0)