diff --git a/src/AspNet.Security.OAuth.Autodesk/AutodeskAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Autodesk/AutodeskAuthenticationConstants.cs new file mode 100644 index 000000000..79134fb45 --- /dev/null +++ b/src/AspNet.Security.OAuth.Autodesk/AutodeskAuthenticationConstants.cs @@ -0,0 +1,21 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Autodesk +{ + /// + /// Contains constants specific to the . + /// + public static class AutodeskAuthenticationConstants + { + public static class Claims + { + public const string EmailVerified = "urn:autodesk:emailverified"; + + public const string TwoFactorEnabled = "urn:autodesk:twofactorenabled"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Autodesk/AutodeskAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Autodesk/AutodeskAuthenticationOptions.cs index 5b64b444c..c77c491ee 100644 --- a/src/AspNet.Security.OAuth.Autodesk/AutodeskAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Autodesk/AutodeskAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Autodesk.AutodeskAuthenticationConstants; namespace AspNet.Security.OAuth.Autodesk { @@ -32,8 +33,8 @@ public AutodeskAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.GivenName, "firstName"); ClaimActions.MapJsonKey(ClaimTypes.Surname, "lastName"); ClaimActions.MapJsonKey(ClaimTypes.Email, "emailId"); - ClaimActions.MapJsonKey("urn:autodesk:emailverified", "emailVerified"); - ClaimActions.MapJsonKey("urn:autodesk:twofactorenabled", "2FaEnabled"); + ClaimActions.MapJsonKey(Claims.EmailVerified, "emailVerified"); + ClaimActions.MapJsonKey(Claims.TwoFactorEnabled, "2FaEnabled"); } } } diff --git a/src/AspNet.Security.OAuth.Bitbucket/BitbucketAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Bitbucket/BitbucketAuthenticationConstants.cs new file mode 100644 index 000000000..6513cd8ed --- /dev/null +++ b/src/AspNet.Security.OAuth.Bitbucket/BitbucketAuthenticationConstants.cs @@ -0,0 +1,21 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Bitbucket +{ + /// + /// Contains constants specific to the . + /// + public static class BitbucketAuthenticationConstants + { + public static class Claims + { + public const string DisplayName = "urn:bitbucket:name"; + + public const string Website = "urn:bitbucket:url"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Bitbucket/BitbucketAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Bitbucket/BitbucketAuthenticationOptions.cs index 1e9dc8b39..06d2ffdba 100644 --- a/src/AspNet.Security.OAuth.Bitbucket/BitbucketAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Bitbucket/BitbucketAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Bitbucket.BitbucketAuthenticationConstants; namespace AspNet.Security.OAuth.Bitbucket { @@ -28,8 +29,8 @@ public BitbucketAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "account_id"); ClaimActions.MapJsonKey(ClaimTypes.Name, "username"); ClaimActions.MapJsonKey(ClaimTypes.Email, "email"); - ClaimActions.MapJsonKey("urn:bitbucket:name", "display_name"); - ClaimActions.MapJsonKey("urn:bitbucket:url", "website"); + ClaimActions.MapJsonKey(Claims.DisplayName, "display_name"); + ClaimActions.MapJsonKey(Claims.Website, "website"); } /// diff --git a/src/AspNet.Security.OAuth.DeviantArt/DeviantArtAuthenticationConstants.cs b/src/AspNet.Security.OAuth.DeviantArt/DeviantArtAuthenticationConstants.cs new file mode 100644 index 000000000..a6b37fa7b --- /dev/null +++ b/src/AspNet.Security.OAuth.DeviantArt/DeviantArtAuthenticationConstants.cs @@ -0,0 +1,19 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.DeviantArt +{ + /// + /// Contains constants specific to the . + /// + public static class DeviantArtAuthenticationConstants + { + public static class Claims + { + public const string Username = "urn:DeviantArt:name"; + } + } +} diff --git a/src/AspNet.Security.OAuth.DeviantArt/DeviantArtAuthenticationOptions.cs b/src/AspNet.Security.OAuth.DeviantArt/DeviantArtAuthenticationOptions.cs index 5e4be24bd..11dcb87f7 100644 --- a/src/AspNet.Security.OAuth.DeviantArt/DeviantArtAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.DeviantArt/DeviantArtAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.DeviantArt.DeviantArtAuthenticationConstants; namespace AspNet.Security.OAuth.DeviantArt { @@ -29,7 +30,7 @@ public DeviantArtAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "userid"); ClaimActions.MapJsonKey(ClaimTypes.Name, "username"); - ClaimActions.MapJsonKey("urn:DeviantArt:name", "username"); + ClaimActions.MapJsonKey(Claims.Username, "username"); } } } diff --git a/src/AspNet.Security.OAuth.EVEOnline/EVEOnlineAuthenticationConstants.cs b/src/AspNet.Security.OAuth.EVEOnline/EVEOnlineAuthenticationConstants.cs new file mode 100644 index 000000000..af6348de5 --- /dev/null +++ b/src/AspNet.Security.OAuth.EVEOnline/EVEOnlineAuthenticationConstants.cs @@ -0,0 +1,19 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.EVEOnline +{ + /// + /// Contains constants specific to the . + /// + public static class EVEOnlineAuthenticationConstants + { + public static class Claims + { + public const string Scopes = "urn:eveonline:scopes"; + } + } +} diff --git a/src/AspNet.Security.OAuth.EVEOnline/EVEOnlineAuthenticationOptions.cs b/src/AspNet.Security.OAuth.EVEOnline/EVEOnlineAuthenticationOptions.cs index cbc9e0964..d5c45c5ef 100644 --- a/src/AspNet.Security.OAuth.EVEOnline/EVEOnlineAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.EVEOnline/EVEOnlineAuthenticationOptions.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.EVEOnline.EVEOnlineAuthenticationConstants; namespace AspNet.Security.OAuth.EVEOnline { @@ -27,7 +28,7 @@ public EVEOnlineAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "CharacterID"); ClaimActions.MapJsonKey(ClaimTypes.Name, "CharacterName"); ClaimActions.MapJsonKey(ClaimTypes.Expiration, "ExpiresOn"); - ClaimActions.MapJsonKey("urn:eveonline:scopes", "Scopes"); + ClaimActions.MapJsonKey(Claims.Scopes, "Scopes"); } /// diff --git a/src/AspNet.Security.OAuth.Fitbit/FitbitAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Fitbit/FitbitAuthenticationConstants.cs new file mode 100644 index 000000000..ea8775e90 --- /dev/null +++ b/src/AspNet.Security.OAuth.Fitbit/FitbitAuthenticationConstants.cs @@ -0,0 +1,21 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Fitbit +{ + /// + /// Contains constants specific to the . + /// + public static class FitbitAuthenticationConstants + { + public static class Claims + { + public const string Avatar = "urn:fitbit:avatar"; + + public const string Avatar150 = "urn:fitbit:avatar150"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Fitbit/FitbitAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Fitbit/FitbitAuthenticationOptions.cs index 6121827e4..48a835d17 100644 --- a/src/AspNet.Security.OAuth.Fitbit/FitbitAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Fitbit/FitbitAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Fitbit.FitbitAuthenticationConstants; namespace AspNet.Security.OAuth.Fitbit { @@ -29,8 +30,8 @@ public FitbitAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "encodedId"); ClaimActions.MapJsonKey(ClaimTypes.Name, "displayName"); - ClaimActions.MapJsonKey("urn:fitbit:avatar", "avatar"); - ClaimActions.MapJsonKey("urn:fitbit:avatar150", "avatar150"); + ClaimActions.MapJsonKey(Claims.Avatar, "avatar"); + ClaimActions.MapJsonKey(Claims.Avatar150, "avatar150"); } } } diff --git a/src/AspNet.Security.OAuth.GitHub/GitHubAuthenticationConstants.cs b/src/AspNet.Security.OAuth.GitHub/GitHubAuthenticationConstants.cs new file mode 100644 index 000000000..f0c913d35 --- /dev/null +++ b/src/AspNet.Security.OAuth.GitHub/GitHubAuthenticationConstants.cs @@ -0,0 +1,21 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.GitHub +{ + /// + /// Contains constants specific to the . + /// + public static class GitHubAuthenticationConstants + { + public static class Claims + { + public const string Name = "urn:github:name"; + + public const string Url = "urn:github:url"; + } + } +} diff --git a/src/AspNet.Security.OAuth.GitHub/GitHubAuthenticationOptions.cs b/src/AspNet.Security.OAuth.GitHub/GitHubAuthenticationOptions.cs index 62c32dd78..6d8a3112a 100644 --- a/src/AspNet.Security.OAuth.GitHub/GitHubAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.GitHub/GitHubAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.GitHub.GitHubAuthenticationConstants; namespace AspNet.Security.OAuth.GitHub { @@ -29,8 +30,8 @@ public GitHubAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id"); ClaimActions.MapJsonKey(ClaimTypes.Name, "login"); ClaimActions.MapJsonKey(ClaimTypes.Email, "email"); - ClaimActions.MapJsonKey("urn:github:name", "name"); - ClaimActions.MapJsonKey("urn:github:url", "url"); + ClaimActions.MapJsonKey(Claims.Name, "name"); + ClaimActions.MapJsonKey(Claims.Url, "url"); } /// diff --git a/src/AspNet.Security.OAuth.Imgur/ImgurAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Imgur/ImgurAuthenticationConstants.cs new file mode 100644 index 000000000..2521b928f --- /dev/null +++ b/src/AspNet.Security.OAuth.Imgur/ImgurAuthenticationConstants.cs @@ -0,0 +1,25 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Imgur +{ + /// + /// Contains constants specific to the . + /// + public static class ImgurAuthenticationConstants + { + public static class Claims + { + public const string Bio = "urn:imgur:bio"; + + public const string Reputation = "urn:imgur:reputation"; + + public const string Created = "urn:imgur:created"; + + public const string ProExpiration = "urn:imgur:proexpiration"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Imgur/ImgurAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Imgur/ImgurAuthenticationOptions.cs index 2ace9e2ca..dc084245d 100644 --- a/src/AspNet.Security.OAuth.Imgur/ImgurAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Imgur/ImgurAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Imgur.ImgurAuthenticationConstants; namespace AspNet.Security.OAuth.Imgur { @@ -27,10 +28,10 @@ public ImgurAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id"); ClaimActions.MapJsonKey(ClaimTypes.Name, "url"); - ClaimActions.MapJsonKey("urn:imgur:bio", "bio"); - ClaimActions.MapJsonKey("urn:imgur:reputation", "reputation"); - ClaimActions.MapJsonKey("urn:imgur:created", "created"); - ClaimActions.MapJsonKey("urn:imgur:proexpiration", "pro_expiration"); + ClaimActions.MapJsonKey(Claims.Bio, "bio"); + ClaimActions.MapJsonKey(Claims.Reputation, "reputation"); + ClaimActions.MapJsonKey(Claims.Created, "created"); + ClaimActions.MapJsonKey(Claims.ProExpiration, "pro_expiration"); } } } diff --git a/src/AspNet.Security.OAuth.LinkedIn/LinkedInAuthenticationConstants.cs b/src/AspNet.Security.OAuth.LinkedIn/LinkedInAuthenticationConstants.cs new file mode 100644 index 000000000..4465cf7cf --- /dev/null +++ b/src/AspNet.Security.OAuth.LinkedIn/LinkedInAuthenticationConstants.cs @@ -0,0 +1,49 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.LinkedIn +{ + /// + /// Contains constants specific to the . + /// + public static class LinkedInAuthenticationConstants + { + public static class Claims + { + public const string MaidenName = "urn:linkedin:maidenname"; + + public const string ProfileUrl = "urn:linkedin:profile"; + + public const string PictureUrl = "urn:linkedin:profilepicture"; + + public const string Industry = "urn:linkedin:industry"; + + public const string Summary = "urn:linkedin:summary"; + + public const string Headline = "urn:linkedin:headline"; + + public const string Positions = "urn:linkedin:positions"; + + public const string PhoneticFirstName = "urn:linkedin:phoneticfirstname"; + + public const string PhoneticLastName = "urn:linkedin:phoneticlastname"; + + public const string FormattedPhoneticName = "urn:linkedin:phoneticname"; + + public const string Location = "urn:linkedin:location"; + + public const string Specialties = "urn:linkedin:specialties"; + + public const string NumConnections = "urn:linkedin:numconnections"; + + public const string NumConnectionsCapped = "urn:linkedin:numconnectionscapped"; + + public const string CurrentShare = "urn:linkedin:currentshare"; + + public const string PictureUrls = "urn:linkedin:pictureurls"; + } + } +} diff --git a/src/AspNet.Security.OAuth.LinkedIn/LinkedInAuthenticationOptions.cs b/src/AspNet.Security.OAuth.LinkedIn/LinkedInAuthenticationOptions.cs index a12ea46d6..769a69317 100644 --- a/src/AspNet.Security.OAuth.LinkedIn/LinkedInAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.LinkedIn/LinkedInAuthenticationOptions.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.LinkedIn.LinkedInAuthenticationConstants; namespace AspNet.Security.OAuth.LinkedIn { @@ -32,22 +33,22 @@ public LinkedInAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.Name, "formattedName"); ClaimActions.MapJsonKey(ClaimTypes.GivenName, "firstName"); ClaimActions.MapJsonKey(ClaimTypes.Surname, "lastName"); - ClaimActions.MapJsonKey("urn:linkedin:maidenname", "maidenName"); - ClaimActions.MapJsonKey("urn:linkedin:profile", "publicProfileUrl"); - ClaimActions.MapJsonKey("urn:linkedin:profilepicture", "pictureUrl"); - ClaimActions.MapJsonKey("urn:linkedin:industry", "industry"); - ClaimActions.MapJsonKey("urn:linkedin:summary", "summary"); - ClaimActions.MapJsonKey("urn:linkedin:headline", "headline"); - ClaimActions.MapCustomJson("urn:linkedin:positions", user => user["positions"]?.ToString()); - ClaimActions.MapJsonKey("urn:linkedin:phoneticfirstname", "phoneticFirstName"); - ClaimActions.MapJsonKey("urn:linkedin:phoneticlastname", "phoneticLastName"); - ClaimActions.MapJsonKey("urn:linkedin:phoneticname", "formattedPhoneticName"); - ClaimActions.MapCustomJson("urn:linkedin:location", user => user["location"]?.ToString()); - ClaimActions.MapJsonKey("urn:linkedin:specialties", "specialties"); - ClaimActions.MapJsonKey("urn:linkedin:numconnections", "numConnections"); - ClaimActions.MapJsonKey("urn:linkedin:numconnectionscapped", "numConnectionsCapped"); - ClaimActions.MapJsonKey("urn:linkedin:currentshare", "currentShare"); - ClaimActions.MapCustomJson("urn:linkedin:pictureurls", user => user["pictureUrls"]?.ToString()); + ClaimActions.MapJsonKey(Claims.MaidenName, "maidenName"); + ClaimActions.MapJsonKey(Claims.ProfileUrl, "publicProfileUrl"); + ClaimActions.MapJsonKey(Claims.PictureUrl, "pictureUrl"); + ClaimActions.MapJsonKey(Claims.Industry, "industry"); + ClaimActions.MapJsonKey(Claims.Summary, "summary"); + ClaimActions.MapJsonKey(Claims.Headline, "headline"); + ClaimActions.MapCustomJson(Claims.Positions, user => user["positions"]?.ToString()); + ClaimActions.MapJsonKey(Claims.PhoneticFirstName, "phoneticFirstName"); + ClaimActions.MapJsonKey(Claims.PhoneticLastName, "phoneticLastName"); + ClaimActions.MapJsonKey(Claims.FormattedPhoneticName, "formattedPhoneticName"); + ClaimActions.MapCustomJson(Claims.Location, user => user["location"]?.ToString()); + ClaimActions.MapJsonKey(Claims.Specialties, "specialties"); + ClaimActions.MapJsonKey(Claims.NumConnections, "numConnections"); + ClaimActions.MapJsonKey(Claims.NumConnectionsCapped, "numConnectionsCapped"); + ClaimActions.MapJsonKey(Claims.CurrentShare, "currentShare"); + ClaimActions.MapCustomJson(Claims.PictureUrls, user => user["pictureUrls"]?.ToString()); } /// diff --git a/src/AspNet.Security.OAuth.Patreon/PatreonAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Patreon/PatreonAuthenticationConstants.cs new file mode 100644 index 000000000..79360e2a7 --- /dev/null +++ b/src/AspNet.Security.OAuth.Patreon/PatreonAuthenticationConstants.cs @@ -0,0 +1,19 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Patreon +{ + /// + /// Contains constants specific to the . + /// + public static class PatreonAuthenticationConstants + { + public static class Claims + { + public const string Avatar = "urn:patreon:avatar"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Patreon/PatreonAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Patreon/PatreonAuthenticationOptions.cs index 78edfcb70..efadb5a75 100644 --- a/src/AspNet.Security.OAuth.Patreon/PatreonAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Patreon/PatreonAuthenticationOptions.cs @@ -4,11 +4,11 @@ * for more information concerning the license and the contributors participating to this project. */ - using System.Security.Claims; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Patreon.PatreonAuthenticationConstants; namespace AspNet.Security.OAuth.Patreon { @@ -34,7 +34,7 @@ public PatreonAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id"); ClaimActions.MapCustomJson(ClaimTypes.Name, user => user["attributes"]?.Value("full_name")); ClaimActions.MapCustomJson(ClaimTypes.Webpage, user => user["attributes"]?.Value("url")); - ClaimActions.MapCustomJson("urn:patreon:avatar", user => user["attributes"]?.Value("thumb_url")); + ClaimActions.MapCustomJson(Claims.Avatar, user => user["attributes"]?.Value("thumb_url")); } } } diff --git a/src/AspNet.Security.OAuth.QQ/QQAuthenticationConstants.cs b/src/AspNet.Security.OAuth.QQ/QQAuthenticationConstants.cs new file mode 100644 index 000000000..8b29e9644 --- /dev/null +++ b/src/AspNet.Security.OAuth.QQ/QQAuthenticationConstants.cs @@ -0,0 +1,27 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.QQ +{ + /// + /// Contains constants specific to the . + /// + public static class QQAuthenticationConstants + { + public static class Claims + { + public const string PictureUrl = "urn:qq:picture"; + + public const string PictureMediumUrl = "urn:qq:picture_medium"; + + public const string PictureFullUrl = "urn:qq:picture_full"; + + public const string AvatarUrl = "urn:qq:avatar"; + + public const string AvatarFullUrl = "urn:qq:avatar_full"; + } + } +} diff --git a/src/AspNet.Security.OAuth.QQ/QQAuthenticationOptions.cs b/src/AspNet.Security.OAuth.QQ/QQAuthenticationOptions.cs index ec42f02f1..0767d97dd 100644 --- a/src/AspNet.Security.OAuth.QQ/QQAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.QQ/QQAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.QQ.QQAuthenticationConstants; namespace AspNet.Security.OAuth.QQ { @@ -30,11 +31,11 @@ public QQAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.Name, "nickname"); ClaimActions.MapJsonKey(ClaimTypes.Gender, "gender"); - ClaimActions.MapJsonKey("urn:qq:picture", "figureurl"); - ClaimActions.MapJsonKey("urn:qq:picture_medium", "figureurl_1"); - ClaimActions.MapJsonKey("urn:qq:picture_full", "figureurl_2"); - ClaimActions.MapJsonKey("urn:qq:avatar", "figureurl_qq_1"); - ClaimActions.MapJsonKey("urn:qq:avatar_full", "figureurl_qq_2"); + ClaimActions.MapJsonKey(Claims.PictureUrl, "figureurl"); + ClaimActions.MapJsonKey(Claims.PictureMediumUrl, "figureurl_1"); + ClaimActions.MapJsonKey(Claims.PictureFullUrl, "figureurl_2"); + ClaimActions.MapJsonKey(Claims.AvatarUrl, "figureurl_qq_1"); + ClaimActions.MapJsonKey(Claims.AvatarFullUrl, "figureurl_qq_2"); } /// diff --git a/src/AspNet.Security.OAuth.Reddit/RedditAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Reddit/RedditAuthenticationConstants.cs new file mode 100644 index 000000000..5739b64ab --- /dev/null +++ b/src/AspNet.Security.OAuth.Reddit/RedditAuthenticationConstants.cs @@ -0,0 +1,19 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Reddit +{ + /// + /// Contains constants specific to the . + /// + public static class RedditAuthenticationConstants + { + public static class Claims + { + public const string Over18 = "urn:reddit:over18"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Reddit/RedditAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Reddit/RedditAuthenticationOptions.cs index d4609f722..4fac8f6e9 100644 --- a/src/AspNet.Security.OAuth.Reddit/RedditAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Reddit/RedditAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Reddit.RedditAuthenticationConstants; namespace AspNet.Security.OAuth.Reddit { @@ -30,7 +31,7 @@ public RedditAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id"); ClaimActions.MapJsonKey(ClaimTypes.Name, "name"); - ClaimActions.MapJsonKey("urn:reddit:over18", "over_18"); + ClaimActions.MapJsonKey(Claims.Over18, "over_18"); } /// diff --git a/src/AspNet.Security.OAuth.Salesforce/SalesforceAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Salesforce/SalesforceAuthenticationConstants.cs new file mode 100644 index 000000000..5f82d5abd --- /dev/null +++ b/src/AspNet.Security.OAuth.Salesforce/SalesforceAuthenticationConstants.cs @@ -0,0 +1,25 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Salesforce +{ + /// + /// Contains constants specific to the . + /// + public static class SalesforceAuthenticationConstants + { + public static class Claims + { + public const string Email = "urn:salesforce:email"; + + public const string ThumbnailPhoto = "urn:salesforce:thumbnail_photo"; + + public const string UtcOffset = "urn:salesforce:utc_offset"; + + public const string RestUrl = "urn:salesforce:rest_url"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Salesforce/SalesforceAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Salesforce/SalesforceAuthenticationOptions.cs index 91c3acf21..057eaa612 100644 --- a/src/AspNet.Security.OAuth.Salesforce/SalesforceAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Salesforce/SalesforceAuthenticationOptions.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Salesforce.SalesforceAuthenticationConstants; namespace AspNet.Security.OAuth.Salesforce { @@ -27,10 +28,10 @@ public SalesforceAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "user_id"); ClaimActions.MapJsonKey(ClaimTypes.Name, "user_name"); - ClaimActions.MapJsonKey("urn:salesforce:email", "email"); - ClaimActions.MapJsonKey("urn:salesforce:thumbnail_photo", "thumbnail"); - ClaimActions.MapJsonKey("urn:salesforce:utc_offset", "utcOffset"); - ClaimActions.MapCustomJson("urn:salesforce:rest_url", user => user["urls"]?.Value("rest")); + ClaimActions.MapJsonKey(Claims.Email, "email"); + ClaimActions.MapJsonKey(Claims.ThumbnailPhoto, "thumbnail"); + ClaimActions.MapJsonKey(Claims.UtcOffset, "utcOffset"); + ClaimActions.MapCustomJson(Claims.RestUrl, user => user["urls"]?.Value("rest")); } public SalesforceAuthenticationEnvironment Environment diff --git a/src/AspNet.Security.OAuth.Slack/SlackAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Slack/SlackAuthenticationConstants.cs new file mode 100644 index 000000000..7dbe1ec1f --- /dev/null +++ b/src/AspNet.Security.OAuth.Slack/SlackAuthenticationConstants.cs @@ -0,0 +1,23 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Slack +{ + /// + /// Contains constants specific to the . + /// + public static class SlackAuthenticationConstants + { + public static class Claims + { + public const string UserId = "urn:slack:user_id"; + + public const string TeamId = "urn:slack:team_id"; + + public const string TeamName = "urn:slack:team_name"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Slack/SlackAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Slack/SlackAuthenticationOptions.cs index 4e12c7d2c..fd95d335c 100644 --- a/src/AspNet.Security.OAuth.Slack/SlackAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Slack/SlackAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Slack.SlackAuthenticationConstants; namespace AspNet.Security.OAuth.Slack { @@ -30,9 +31,9 @@ public SlackAuthenticationOptions() string.Concat(user["team"]["id"], "|", user["user"]["id"])); ClaimActions.MapJsonSubKey(ClaimTypes.Name, "user", "name"); ClaimActions.MapJsonSubKey(ClaimTypes.Email, "user", "email"); - ClaimActions.MapJsonSubKey("urn:slack:user_id", "user", "id"); - ClaimActions.MapJsonSubKey("urn:slack:team_id", "team", "id"); - ClaimActions.MapJsonSubKey("urn:slack:team_name", "team", "name"); + ClaimActions.MapJsonSubKey(Claims.UserId, "user", "id"); + ClaimActions.MapJsonSubKey(Claims.TeamId, "team", "id"); + ClaimActions.MapJsonSubKey(Claims.TeamName, "team", "name"); Scope.Add("identity.basic"); } diff --git a/src/AspNet.Security.OAuth.SoundCloud/SoundCloudAuthenticationConstants.cs b/src/AspNet.Security.OAuth.SoundCloud/SoundCloudAuthenticationConstants.cs new file mode 100644 index 000000000..543391347 --- /dev/null +++ b/src/AspNet.Security.OAuth.SoundCloud/SoundCloudAuthenticationConstants.cs @@ -0,0 +1,23 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.SoundCloud +{ + /// + /// Contains constants specific to the . + /// + public static class SoundCloudAuthenticationConstants + { + public static class Claims + { + public const string FullName = "urn:soundcloud:fullname"; + + public const string City = "urn:soundcloud:city"; + + public const string ProfileUrl = "urn:soundcloud:profileurl"; + } + } +} diff --git a/src/AspNet.Security.OAuth.SoundCloud/SoundCloudAuthenticationOptions.cs b/src/AspNet.Security.OAuth.SoundCloud/SoundCloudAuthenticationOptions.cs index 7c895c85a..848d052bc 100644 --- a/src/AspNet.Security.OAuth.SoundCloud/SoundCloudAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.SoundCloud/SoundCloudAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.SoundCloud.SoundCloudAuthenticationConstants; namespace AspNet.Security.OAuth.SoundCloud { @@ -29,9 +30,9 @@ public SoundCloudAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id"); ClaimActions.MapJsonKey(ClaimTypes.Name, "username"); ClaimActions.MapJsonKey(ClaimTypes.Country, "country"); - ClaimActions.MapJsonKey("urn:soundcloud:fullname", "full_name"); - ClaimActions.MapJsonKey("urn:soundcloud:city", "city"); - ClaimActions.MapJsonKey("urn:soundcloud:profileurl", "permalink_url"); + ClaimActions.MapJsonKey(Claims.FullName, "full_name"); + ClaimActions.MapJsonKey(Claims.City, "city"); + ClaimActions.MapJsonKey(Claims.ProfileUrl, "permalink_url"); } } } diff --git a/src/AspNet.Security.OAuth.Spotify/SpotifyAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Spotify/SpotifyAuthenticationConstants.cs new file mode 100644 index 000000000..9089e5751 --- /dev/null +++ b/src/AspNet.Security.OAuth.Spotify/SpotifyAuthenticationConstants.cs @@ -0,0 +1,21 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Spotify +{ + /// + /// Contains constants specific to the . + /// + public static class SpotifyAuthenticationConstants + { + public static class Claims + { + public const string Product = "urn:spotify:product"; + + public const string Url = "urn:spotify:url"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Spotify/SpotifyAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Spotify/SpotifyAuthenticationOptions.cs index bc3c9a1ce..76b5eb5d5 100644 --- a/src/AspNet.Security.OAuth.Spotify/SpotifyAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Spotify/SpotifyAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Spotify.SpotifyAuthenticationConstants; namespace AspNet.Security.OAuth.Spotify { @@ -32,8 +33,8 @@ public SpotifyAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.DateOfBirth, "birthdate"); ClaimActions.MapJsonKey(ClaimTypes.Country, "country"); ClaimActions.MapJsonKey(ClaimTypes.Uri, "uri"); - ClaimActions.MapJsonKey("urn:spotify:product", "product"); - ClaimActions.MapJsonSubKey("urn:spotify:url", "external_urls", "spotify"); + ClaimActions.MapJsonKey(Claims.Product, "product"); + ClaimActions.MapJsonSubKey(Claims.Url, "external_urls", "spotify"); } } } \ No newline at end of file diff --git a/src/AspNet.Security.OAuth.StackExchange/StackExchangeAuthenticationConstants.cs b/src/AspNet.Security.OAuth.StackExchange/StackExchangeAuthenticationConstants.cs new file mode 100644 index 000000000..ed7c5f1c1 --- /dev/null +++ b/src/AspNet.Security.OAuth.StackExchange/StackExchangeAuthenticationConstants.cs @@ -0,0 +1,19 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.StackExchange +{ + /// + /// Contains constants specific to the . + /// + public static class StackExchangeAuthenticationConstants + { + public static class Claims + { + public const string Link = "urn:stackexchange:link"; + } + } +} diff --git a/src/AspNet.Security.OAuth.StackExchange/StackExchangeAuthenticationOptions.cs b/src/AspNet.Security.OAuth.StackExchange/StackExchangeAuthenticationOptions.cs index b42e1f480..9ebb6accc 100644 --- a/src/AspNet.Security.OAuth.StackExchange/StackExchangeAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.StackExchange/StackExchangeAuthenticationOptions.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.StackExchange.StackExchangeAuthenticationConstants; namespace AspNet.Security.OAuth.StackExchange { @@ -32,7 +33,7 @@ public StackExchangeAuthenticationOptions() ClaimActions.MapCustomJson(ClaimTypes.NameIdentifier, user => user[0]?.Value("account_id")); ClaimActions.MapCustomJson(ClaimTypes.Name, user => user[0]?.Value("display_name")); ClaimActions.MapCustomJson(ClaimTypes.Webpage, user => user[0]?.Value("website_url")); - ClaimActions.MapCustomJson("urn:stackexchange:link", user => user[0]?.Value("link")); + ClaimActions.MapCustomJson(Claims.Link, user => user[0]?.Value("link")); } /// diff --git a/src/AspNet.Security.OAuth.Strava/StravaAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Strava/StravaAuthenticationConstants.cs new file mode 100644 index 000000000..dd26b51ae --- /dev/null +++ b/src/AspNet.Security.OAuth.Strava/StravaAuthenticationConstants.cs @@ -0,0 +1,29 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Strava +{ + /// + /// Contains constants specific to the . + /// + public static class StravaAuthenticationConstants + { + public static class Claims + { + public const string City = "urn:strava:city"; + + public const string Profile = "urn:strava:profile"; + + public const string ProfileMedium = "urn:strava:profile-medium"; + + public const string CreatedAt = "urn:strava:created-at"; + + public const string UpdatedAt = "urn:strava:updated-at"; + + public const string Premium = "urn:strava:premium"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Strava/StravaAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Strava/StravaAuthenticationOptions.cs index 3230c9563..13b8ab53f 100644 --- a/src/AspNet.Security.OAuth.Strava/StravaAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Strava/StravaAuthenticationOptions.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Strava.StravaAuthenticationConstants; namespace AspNet.Security.OAuth.Strava { @@ -35,12 +36,12 @@ public StravaAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.StateOrProvince, "state"); ClaimActions.MapJsonKey(ClaimTypes.Country, "country"); ClaimActions.MapJsonKey(ClaimTypes.Gender, "sex"); - ClaimActions.MapJsonKey("urn:strava:city", "city"); - ClaimActions.MapJsonKey("urn:strava:profile", "profile"); - ClaimActions.MapJsonKey("urn:strava:profile-medium", "profile_medium"); - ClaimActions.MapJsonKey("urn:strava:created-at", "created_at"); - ClaimActions.MapJsonKey("urn:strava:updated-at", "updated_at"); - ClaimActions.MapJsonKey("urn:strava:premium", "premium"); + ClaimActions.MapJsonKey(Claims.City, "city"); + ClaimActions.MapJsonKey(Claims.Profile, "profile"); + ClaimActions.MapJsonKey(Claims.ProfileMedium, "profile_medium"); + ClaimActions.MapJsonKey(Claims.CreatedAt, "created_at"); + ClaimActions.MapJsonKey(Claims.UpdatedAt, "updated_at"); + ClaimActions.MapJsonKey(Claims.Premium, "premium"); } } } diff --git a/src/AspNet.Security.OAuth.Untappd/UntappdAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Untappd/UntappdAuthenticationConstants.cs new file mode 100644 index 000000000..55d67f760 --- /dev/null +++ b/src/AspNet.Security.OAuth.Untappd/UntappdAuthenticationConstants.cs @@ -0,0 +1,19 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Untappd +{ + /// + /// Contains constants specific to the . + /// + public static class UntappdAuthenticationConstants + { + public static class Claims + { + public const string Avatar = "urn:untappd:link"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Untappd/UntappdAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Untappd/UntappdAuthenticationOptions.cs index 4c3920aa7..fc2bfc02f 100644 --- a/src/AspNet.Security.OAuth.Untappd/UntappdAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Untappd/UntappdAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Untappd.UntappdAuthenticationConstants; namespace AspNet.Security.OAuth.Untappd { @@ -31,7 +32,7 @@ public UntappdAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.Surname, "last_name"); ClaimActions.MapJsonKey(ClaimTypes.Name, "user_name"); ClaimActions.MapJsonKey(ClaimTypes.Webpage, "url"); - ClaimActions.MapJsonKey("urn:untappd:link", "user_avatar"); + ClaimActions.MapJsonKey(Claims.Avatar, "user_avatar"); } } } \ No newline at end of file diff --git a/src/AspNet.Security.OAuth.Vimeo/VimeoAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Vimeo/VimeoAuthenticationConstants.cs new file mode 100644 index 000000000..408abfebd --- /dev/null +++ b/src/AspNet.Security.OAuth.Vimeo/VimeoAuthenticationConstants.cs @@ -0,0 +1,21 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Vimeo +{ + /// + /// Contains constants specific to the . + /// + public static class VimeoAuthenticationConstants + { + public static class Claims + { + public const string FullName = "urn:vimeo:fullname"; + + public const string ProfileUrl = "urn:vimeo:profileurl"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Vimeo/VimeoAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Vimeo/VimeoAuthenticationOptions.cs index 3dda581f3..77a31cbcb 100644 --- a/src/AspNet.Security.OAuth.Vimeo/VimeoAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Vimeo/VimeoAuthenticationOptions.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Vimeo.VimeoAuthenticationConstants; namespace AspNet.Security.OAuth.Vimeo { @@ -26,8 +27,8 @@ public VimeoAuthenticationOptions() TokenEndpoint = VimeoAuthenticationDefaults.TokenEndpoint; UserInformationEndpoint = VimeoAuthenticationDefaults.UserInformationEndpoint; - ClaimActions.MapJsonKey("urn:vimeo:fullname", "name"); - ClaimActions.MapJsonKey("urn:vimeo:profileurl", "link"); + ClaimActions.MapJsonKey(Claims.FullName, "name"); + ClaimActions.MapJsonKey(Claims.ProfileUrl, "link"); ClaimActions.MapCustomJson(ClaimTypes.NameIdentifier, user => user.Value("uri")?.Split('/')?.LastOrDefault()); } } diff --git a/src/AspNet.Security.OAuth.Vkontakte/VkontakteAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Vkontakte/VkontakteAuthenticationConstants.cs new file mode 100644 index 000000000..80e60bf07 --- /dev/null +++ b/src/AspNet.Security.OAuth.Vkontakte/VkontakteAuthenticationConstants.cs @@ -0,0 +1,21 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Vkontakte +{ + /// + /// Contains constants specific to the . + /// + public static class VkontakteAuthenticationConstants + { + public static class Claims + { + public const string PhotoUrl = "urn:vkontakte:photo:link"; + + public const string ThumbnailUrl = "urn:vkontakte:photo_thumb:link"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Vkontakte/VkontakteAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Vkontakte/VkontakteAuthenticationOptions.cs index b86ca1e91..067e629fb 100644 --- a/src/AspNet.Security.OAuth.Vkontakte/VkontakteAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Vkontakte/VkontakteAuthenticationOptions.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Vkontakte.VkontakteAuthenticationConstants; namespace AspNet.Security.OAuth.Vkontakte { @@ -31,8 +32,8 @@ public VkontakteAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.GivenName, "first_name"); ClaimActions.MapJsonKey(ClaimTypes.Surname, "last_name"); ClaimActions.MapJsonKey(ClaimTypes.Hash, "hash"); - ClaimActions.MapJsonKey("urn:vkontakte:photo:link", "photo"); - ClaimActions.MapJsonKey("urn:vkontakte:photo_thumb:link", "photo_rec"); + ClaimActions.MapJsonKey(Claims.PhotoUrl, "photo"); + ClaimActions.MapJsonKey(Claims.ThumbnailUrl, "photo_rec"); } /// diff --git a/src/AspNet.Security.OAuth.Weibo/WeiboAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Weibo/WeiboAuthenticationConstants.cs new file mode 100644 index 000000000..1235db1bf --- /dev/null +++ b/src/AspNet.Security.OAuth.Weibo/WeiboAuthenticationConstants.cs @@ -0,0 +1,29 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Weibo +{ + /// + /// Contains constants specific to the . + /// + public static class WeiboAuthenticationConstants + { + public static class Claims + { + public const string ScreenName = "urn:weibo:screen_name"; + + public const string ProfileImageUrl = "urn:weibo:profile_image_url"; + + public const string AvatarLarge = "urn:weibo:avatar_large"; + + public const string AvatarHd = "urn:weibo:avatar_hd"; + + public const string CoverImagePhone = "urn:weibo:cover_image_phone"; + + public const string Location = "urn:weibo:location"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Weibo/WeiboAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Weibo/WeiboAuthenticationOptions.cs index b1a493e88..9bd9e0306 100644 --- a/src/AspNet.Security.OAuth.Weibo/WeiboAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Weibo/WeiboAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Weibo.WeiboAuthenticationConstants; namespace AspNet.Security.OAuth.Weibo { @@ -30,12 +31,12 @@ public WeiboAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id"); ClaimActions.MapJsonKey(ClaimTypes.Name, "name"); ClaimActions.MapJsonKey(ClaimTypes.Gender, "gender"); - ClaimActions.MapJsonKey("urn:weibo:screen_name", "screen_name"); - ClaimActions.MapJsonKey("urn:weibo:profile_image_url", "profile_image_url"); - ClaimActions.MapJsonKey("urn:weibo:avatar_large", "avatar_large"); - ClaimActions.MapJsonKey("urn:weibo:avatar_hd", "avatar_hd"); - ClaimActions.MapJsonKey("urn:weibo:cover_image_phone", "cover_image_phone"); - ClaimActions.MapJsonKey("urn:weibo:location", "location"); + ClaimActions.MapJsonKey(Claims.ScreenName, "screen_name"); + ClaimActions.MapJsonKey(Claims.ProfileImageUrl, "profile_image_url"); + ClaimActions.MapJsonKey(Claims.AvatarLarge, "avatar_large"); + ClaimActions.MapJsonKey(Claims.AvatarHd, "avatar_hd"); + ClaimActions.MapJsonKey(Claims.CoverImagePhone, "cover_image_phone"); + ClaimActions.MapJsonKey(Claims.Location, "location"); } } } diff --git a/src/AspNet.Security.OAuth.Weixin/WeixinAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Weixin/WeixinAuthenticationConstants.cs new file mode 100644 index 000000000..9d1fcd584 --- /dev/null +++ b/src/AspNet.Security.OAuth.Weixin/WeixinAuthenticationConstants.cs @@ -0,0 +1,27 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Weixin +{ + /// + /// Contains constants specific to the . + /// + public static class WeixinAuthenticationConstants + { + public static class Claims + { + public const string OpenId = "urn:weixin:openid"; + + public const string Province = "urn:weixin:province"; + + public const string City = "urn:weixin:city"; + + public const string HeadImgUrl = "urn:weixin:headimgurl"; + + public const string Privilege = "urn:weixin:privilege"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Weixin/WeixinAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Weixin/WeixinAuthenticationOptions.cs index c7f959d7e..ba105f18b 100644 --- a/src/AspNet.Security.OAuth.Weixin/WeixinAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Weixin/WeixinAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Weixin.WeixinAuthenticationConstants; namespace AspNet.Security.OAuth.Weixin { @@ -32,11 +33,11 @@ public WeixinAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.Name, "nickname"); ClaimActions.MapJsonKey(ClaimTypes.Gender, "sex"); ClaimActions.MapJsonKey(ClaimTypes.Country, "country"); - ClaimActions.MapJsonKey("urn:weixin:openid", "openid"); - ClaimActions.MapJsonKey("urn:weixin:province", "province"); - ClaimActions.MapJsonKey("urn:weixin:city", "city"); - ClaimActions.MapJsonKey("urn:weixin:headimgurl", "headimgurl"); - ClaimActions.MapJsonKey("urn:weixin:privilege", "privilege"); + ClaimActions.MapJsonKey(Claims.OpenId, "openid"); + ClaimActions.MapJsonKey(Claims.Province, "province"); + ClaimActions.MapJsonKey(Claims.City, "city"); + ClaimActions.MapJsonKey(Claims.HeadImgUrl, "headimgurl"); + ClaimActions.MapJsonKey(Claims.Privilege, "privilege"); } } } diff --git a/src/AspNet.Security.OAuth.WordPress/WordPressAuthenticationConstants.cs b/src/AspNet.Security.OAuth.WordPress/WordPressAuthenticationConstants.cs new file mode 100644 index 000000000..c5ae933a2 --- /dev/null +++ b/src/AspNet.Security.OAuth.WordPress/WordPressAuthenticationConstants.cs @@ -0,0 +1,27 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.WordPress +{ + /// + /// Contains constants specific to the . + /// + public static class WordPressAuthenticationConstants + { + public static class Claims + { + public const string Email = "urn:wordpress:email"; + + public const string DisplayName = "urn:wordpress:displayname"; + + public const string ProfileUrl = "urn:wordpress:profileurl"; + + public const string AvatarUrl = "urn:wordpress:avatarurl"; + + public const string PrimaryBlog = "urn:wordpress:primaryblog"; + } + } +} diff --git a/src/AspNet.Security.OAuth.WordPress/WordPressAuthenticationOptions.cs b/src/AspNet.Security.OAuth.WordPress/WordPressAuthenticationOptions.cs index 76b5cf0c3..af44defea 100644 --- a/src/AspNet.Security.OAuth.WordPress/WordPressAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.WordPress/WordPressAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.WordPress.WordPressAuthenticationConstants; namespace AspNet.Security.OAuth.WordPress { @@ -31,11 +32,11 @@ public WordPressAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "ID"); ClaimActions.MapJsonKey(ClaimTypes.Name, "username"); - ClaimActions.MapJsonKey("urn:wordpress:email", "email"); - ClaimActions.MapJsonKey("urn:wordpress:displayname", "display_name"); - ClaimActions.MapJsonKey("urn:wordpress:profileurl", "profile_URL"); - ClaimActions.MapJsonKey("urn:wordpress:avatarurl", "avatar_URL"); - ClaimActions.MapJsonKey("urn:wordpress:primaryblog", "primary_blog"); + ClaimActions.MapJsonKey(Claims.Email, "email"); + ClaimActions.MapJsonKey(Claims.DisplayName, "display_name"); + ClaimActions.MapJsonKey(Claims.ProfileUrl, "profile_URL"); + ClaimActions.MapJsonKey(Claims.AvatarUrl, "avatar_URL"); + ClaimActions.MapJsonKey(Claims.PrimaryBlog, "primary_blog"); } } } \ No newline at end of file diff --git a/src/AspNet.Security.OAuth.Yahoo/YahooAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Yahoo/YahooAuthenticationConstants.cs new file mode 100644 index 000000000..17965605e --- /dev/null +++ b/src/AspNet.Security.OAuth.Yahoo/YahooAuthenticationConstants.cs @@ -0,0 +1,25 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Yahoo +{ + /// + /// Contains constants specific to the . + /// + public static class YahooAuthenticationConstants + { + public static class Claims + { + public const string FamilyName = "urn:yahoo:familyname"; + + public const string GivenName = "urn:yahoo:givenname"; + + public const string ProfileUrl = "urn:yahoo:profile"; + + public const string ImageUrl = "urn:yahoo:profileimage"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Yahoo/YahooAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Yahoo/YahooAuthenticationOptions.cs index 1a9981aaf..eccbf38b2 100644 --- a/src/AspNet.Security.OAuth.Yahoo/YahooAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Yahoo/YahooAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Yahoo.YahooAuthenticationConstants; namespace AspNet.Security.OAuth.Yahoo { @@ -27,10 +28,10 @@ public YahooAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "guid"); ClaimActions.MapJsonKey(ClaimTypes.Name, "nickname"); - ClaimActions.MapJsonKey("urn:yahoo:familyname", "familyName"); - ClaimActions.MapJsonKey("urn:yahoo:givenname", "givenName"); - ClaimActions.MapJsonKey("urn:yahoo:profile", "profileUrl"); - ClaimActions.MapJsonKey("urn:yahoo:profileimage", "imageUrl"); + ClaimActions.MapJsonKey(Claims.FamilyName, "familyName"); + ClaimActions.MapJsonKey(Claims.GivenName, "givenName"); + ClaimActions.MapJsonKey(Claims.ProfileUrl, "profileUrl"); + ClaimActions.MapJsonKey(Claims.ImageUrl, "imageUrl"); } } } \ No newline at end of file diff --git a/src/AspNet.Security.OAuth.Yammer/YammerAuthenticationConstants.cs b/src/AspNet.Security.OAuth.Yammer/YammerAuthenticationConstants.cs new file mode 100644 index 000000000..cdf67def3 --- /dev/null +++ b/src/AspNet.Security.OAuth.Yammer/YammerAuthenticationConstants.cs @@ -0,0 +1,21 @@ +/* + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers + * for more information concerning the license and the contributors participating to this project. + */ + +namespace AspNet.Security.OAuth.Yammer +{ + /// + /// Contains constants specific to the . + /// + public static class YammerAuthenticationConstants + { + public static class Claims + { + public const string WebUrl = "urn:yammer:link"; + + public const string JobTitle = "urn:yammer:job_title"; + } + } +} diff --git a/src/AspNet.Security.OAuth.Yammer/YammerAuthenticationOptions.cs b/src/AspNet.Security.OAuth.Yammer/YammerAuthenticationOptions.cs index 6e0dd4594..573300e51 100644 --- a/src/AspNet.Security.OAuth.Yammer/YammerAuthenticationOptions.cs +++ b/src/AspNet.Security.OAuth.Yammer/YammerAuthenticationOptions.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; +using static AspNet.Security.OAuth.Yammer.YammerAuthenticationConstants; namespace AspNet.Security.OAuth.Yammer { @@ -31,8 +32,8 @@ public YammerAuthenticationOptions() ClaimActions.MapJsonKey(ClaimTypes.Surname, "last_name"); ClaimActions.MapJsonKey(ClaimTypes.Name, "name"); ClaimActions.MapJsonKey(ClaimTypes.Email, "email"); - ClaimActions.MapJsonKey("urn:yammer:link", "web_url"); - ClaimActions.MapJsonKey("urn:yammer:job_title", "job_title"); + ClaimActions.MapJsonKey(Claims.WebUrl, "web_url"); + ClaimActions.MapJsonKey(Claims.JobTitle, "job_title"); } } } \ No newline at end of file