diff --git a/src/Libraries/Thinktecture.IdentityServer.Protocols/OpenIdConnect/OidcConstants.cs b/src/Libraries/Thinktecture.IdentityServer.Protocols/OpenIdConnect/OidcConstants.cs deleted file mode 100644 index 599e93de..00000000 --- a/src/Libraries/Thinktecture.IdentityServer.Protocols/OpenIdConnect/OidcConstants.cs +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) Dominick Baier, Brock Allen. All rights reserved. - * see license.txt - */ - -using System.Collections.Generic; - -namespace Thinktecture.IdentityServer.Protocols.OpenIdConnect -{ - public static class OidcConstants - { - static Dictionary> _dictionary = new Dictionary> - { - { Scopes.Profile, new string[] - { - ClaimTypes.Name, - ClaimTypes.FamilyName, - ClaimTypes.GivenName, - ClaimTypes.MiddleName, - ClaimTypes.NickName, - ClaimTypes.PreferredUserName, - ClaimTypes.Profile, - ClaimTypes.Picture, - ClaimTypes.WebSite, - ClaimTypes.Gender, - ClaimTypes.BirthDate, - ClaimTypes.ZoneInfo, - ClaimTypes.Locale, - ClaimTypes.UpdatedAt - }}, - { Scopes.Email, new string[] - { - ClaimTypes.Email, - ClaimTypes.EmailVerified - }}, - { Scopes.Address, new string[] - { - ClaimTypes.Address - }}, - { Scopes.Phone, new string[] - { - ClaimTypes.PhoneNumber, - ClaimTypes.PhoneNumberVerified - }}, - }; - - public static Dictionary> Mappings - { - get { return _dictionary; } - } - - public static class Scopes - { - public const string OpenId = "openid"; - public const string Profile = "profile"; - public const string Email = "email"; - public const string Address = "address"; - public const string Phone = "phone"; - public const string OfflineAccess = "offline_access"; - } - - public static class ClaimTypes - { - public const string Subject = "sub"; - public const string Name = "name"; - public const string GivenName = "given_name"; - public const string FamilyName = "family_name"; - public const string MiddleName = "middle_name"; - public const string NickName = "nickname"; - public const string PreferredUserName = "preferred_username"; - public const string Profile = "profile"; - public const string Picture = "picture"; - public const string WebSite = "website"; - public const string Email = "email"; - public const string EmailVerified = "email_verified"; - public const string Gender = "gender"; - public const string BirthDate = "birthdate"; - public const string ZoneInfo = "zoneinfo"; - public const string Locale = "locale"; - public const string PhoneNumber = "phone_number"; - public const string PhoneNumberVerified = "phone_number_verified"; - public const string Address = "address"; - public const string UpdatedAt = "updated_at"; - } - } -} diff --git a/src/Libraries/Thinktecture.IdentityServer.Protocols/OpenIdConnect/UserInfoController.cs b/src/Libraries/Thinktecture.IdentityServer.Protocols/OpenIdConnect/UserInfoController.cs deleted file mode 100644 index 3e62c457..00000000 --- a/src/Libraries/Thinktecture.IdentityServer.Protocols/OpenIdConnect/UserInfoController.cs +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) Dominick Baier, Brock Allen. All rights reserved. - * see license.txt - */ - -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.IdentityModel.Protocols.WSTrust; -using System.Net; -using System.Net.Http; -using System.Security.Claims; -using System.Web.Http; -using Thinktecture.IdentityModel; -using Thinktecture.IdentityModel.Constants; -using Thinktecture.IdentityServer.Repositories; -using Thinktecture.IdentityServer.TokenService; - -namespace Thinktecture.IdentityServer.Protocols.OpenIdConnect -{ - [Authorize] - public class UserInfoController : ApiController - { - [Import] - public IClaimsRepository ClaimsRepository { get; set; } - - public UserInfoController() - { - Container.Current.SatisfyImportsOnce(this); - } - - public UserInfoController(IClaimsRepository claimsRepository) - { - ClaimsRepository = claimsRepository; - } - - HttpResponseMessage Get() - { - var requestClaims = new RequestClaimCollection(); - - var scopes = ClaimsPrincipal.Current.FindAll(OAuth2Constants.Scope); - foreach (var scope in scopes) - { - if (OidcConstants.Mappings.ContainsKey(scope.Value)) - { - foreach (var oidcClaim in OidcConstants.Mappings[scope.Value]) - { - requestClaims.Add(new RequestClaim(oidcClaim)); - } - } - else - { - Request.CreateErrorResponse(HttpStatusCode.BadRequest, "invalid scope"); - } - } - - var details = new RequestDetails { IsOpenIdRequest = true }; - details.ClaimsRequested = true; - details.RequestClaims = requestClaims; - - var principal = Principal.Create("OpenIdConnect", - new Claim(ClaimTypes.NameIdentifier, ClaimsPrincipal.Current.FindFirst("sub").Value)); - - var claims = ClaimsRepository.GetClaims(principal, details); - - var dictionary = new Dictionary(); - foreach (var claim in claims) - { - if (!dictionary.ContainsKey(claim.Type)) - { - dictionary.Add(claim.Type, claim.Value); - } - else - { - var currentValue = dictionary[claim.Type]; - dictionary[claim.Type] = currentValue += ("," + claim.Value); - } - } - - return Request.CreateResponse>(HttpStatusCode.OK, dictionary, "application/json"); - } - } -} \ No newline at end of file diff --git a/src/Libraries/Thinktecture.IdentityServer.Protocols/Thinktecture.IdentityServer.Protocols.csproj b/src/Libraries/Thinktecture.IdentityServer.Protocols/Thinktecture.IdentityServer.Protocols.csproj index 2569fbc3..41841eac 100644 --- a/src/Libraries/Thinktecture.IdentityServer.Protocols/Thinktecture.IdentityServer.Protocols.csproj +++ b/src/Libraries/Thinktecture.IdentityServer.Protocols/Thinktecture.IdentityServer.Protocols.csproj @@ -81,8 +81,6 @@ - - True True