public ClientRepository(
     SimpleIdentityServerContext context,
     ITechnicalEventSource managerEventSource)
 {
     _context            = context;
     _managerEventSource = managerEventSource;
 }
 public AuthorizationCodeRepository(
     SimpleIdentityServerContext context,
     IManagerEventSource managerEventSource)
 {
     _context            = context;
     _managerEventSource = managerEventSource;
 }
Exemple #3
0
 public GrantedTokenRepository(
     SimpleIdentityServerContext context,
     IManagerEventSource managerEventSource)
 {
     _context            = context;
     _managerEventSource = managerEventSource;
 }
Exemple #4
0
        private static void InsertJsonWebKeys(SimpleIdentityServerContext context)
        {
            if (!context.JsonWebKeys.Any())
            {
                var serializedRsa = string.Empty;
                using (var provider = new RSACryptoServiceProvider())
                {
                    serializedRsa = provider.ToXmlString(true);
                }

                context.JsonWebKeys.AddRange(new[]
                {
                    new JsonWebKey
                    {
                        Alg           = AllAlg.RS256,
                        KeyOps        = "0,1",
                        Kid           = "1",
                        Kty           = KeyType.RSA,
                        Use           = Use.Sig,
                        SerializedKey = serializedRsa,
                    },
                    new JsonWebKey
                    {
                        Alg           = AllAlg.RSA1_5,
                        KeyOps        = "2,3",
                        Kid           = "2",
                        Kty           = KeyType.RSA,
                        Use           = Use.Enc,
                        SerializedKey = serializedRsa,
                    }
                });
            }
        }
 private static void InsertConsents(SimpleIdentityServerContext context)
 {
     if (!context.Consents.Any())
     {
         var consents = new List <Consent>()
         {
             new Consent
             {
                 Id              = "1",
                 ClientId        = "authcode_client",
                 ResourceOwnerId = "administrator"
             },
             new Consent
             {
                 Id              = "2",
                 ClientId        = "implicit_client",
                 ResourceOwnerId = "administrator"
             },
             new Consent
             {
                 Id              = "3",
                 ClientId        = "hybrid_client",
                 ResourceOwnerId = "administrator"
             },
             new Consent
             {
                 Id              = "4",
                 ClientId        = "pkce_client",
                 ResourceOwnerId = "administrator"
             }
         };
         context.Consents.AddRange(consents);
     }
 }
Exemple #6
0
 public ResourceOwnerRepository(
     SimpleIdentityServerContext context,
     IManagerEventSource managerEventSource)
 {
     _context            = context;
     _managerEventSource = managerEventSource;
 }
Exemple #7
0
 public static void EnsureSeedData(this SimpleIdentityServerContext context)
 {
     InsertScopes(context);
     InsertJsonWebKeys(context);
     InsertClients(context);
     context.SaveChanges();
 }
Exemple #8
0
 public TranslationRepository(
     SimpleIdentityServerContext context,
     IManagerEventSource managerEventSource)
 {
     _context            = context;
     _managerEventSource = managerEventSource;
 }
Exemple #9
0
 private static void InsertResourceOwners(SimpleIdentityServerContext context)
 {
     if (!context.ResourceOwners.Any())
     {
         context.ResourceOwners.AddRange(new[]
         {
             new ResourceOwner
             {
                 Id     = "administrator",
                 Claims = new List <ResourceOwnerClaim>
                 {
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Subject,
                         Value     = "administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Role,
                         Value     = "administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.ScimId,
                         Value     = "7d79392f-8a02-494c-949e-723a4db8ed16"
                     }
                 },
                 Password       = "******",
                 IsLocalAccount = true
             },
             new ResourceOwner
             {
                 Id     = "test",
                 Claims = new List <ResourceOwnerClaim>
                 {
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Subject,
                         Value     = "test"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Role,
                         Value     = "test"
                     }
                 },
                 Password                = "******",
                 IsLocalAccount          = true,
                 TwoFactorAuthentication = "SMS"
             }
         });
     }
 }
 public static void EnsureSeedData(this SimpleIdentityServerContext context)
 {
     InsertClaims(context);
     InsertScopes(context);
     InsertTranslations(context);
     InsertResourceOwners(context);
     InsertJsonWebKeys(context);
     InsertClients(context);
     context.SaveChanges();
 }
Exemple #11
0
 public static void EnsureSeedData(this SimpleIdentityServerContext context, SharedContext sharedContext)
 {
     InsertScopes(context);
     InsertTranslations(context);
     InsertJsonWebKeys(context, sharedContext);
     InsertClients(context);
     try
     {
         context.SaveChanges();
     }
     catch { }
 }
Exemple #12
0
 private static void InsertClients(SimpleIdentityServerContext context)
 {
     if (!context.Clients.Any())
     {
         context.Clients.AddRange(new[]
         {
             new Client
             {
                 ClientId      = "EhealthClientId",
                 ClientName    = "Eheath application",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "EhealthClientSecret"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "openid"
                     },
                     new ClientScope
                     {
                         ScopeName = "role"
                     },
                     new ClientScope
                     {
                         ScopeName = "profile"
                     },
                     new ClientScope
                     {
                         ScopeName = "email"
                     },
                     new ClientScope
                     {
                         ScopeName = "address"
                     }
                 },
                 GrantTypes               = "1,4",
                 ResponseTypes            = "0,1,2",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "http://localhost:3002/callback"
             }
         });
     }
 }
Exemple #13
0
 public static void EnsureSeedData(this SimpleIdentityServerContext context, SharedContext sharedCtx)
 {
     InsertClaims(context);
     InsertScopes(context);
     InsertResourceOwners(context);
     try
     {
         context.SaveChanges();
     }
     catch
     {
         Trace.WriteLine("items already exists");
     }
 }
 private static void InsertConsentScopes(SimpleIdentityServerContext context)
 {
     if (!context.ConsentScopes.Any())
     {
         var consentScopes = new List <ConsentScope>
         {
             new ConsentScope
             {
                 ConsentId = "1",
                 ScopeName = "api1"
             },
             new ConsentScope
             {
                 ConsentId = "1",
                 ScopeName = "openid"
             },
             new ConsentScope
             {
                 ConsentId = "2",
                 ScopeName = "api1"
             },
             new ConsentScope
             {
                 ConsentId = "2",
                 ScopeName = "openid"
             },
             new ConsentScope
             {
                 ConsentId = "3",
                 ScopeName = "api1"
             },
             new ConsentScope
             {
                 ConsentId = "3",
                 ScopeName = "openid"
             },
             new ConsentScope
             {
                 ConsentId = "4",
                 ScopeName = "api1"
             },
             new ConsentScope
             {
                 ConsentId = "4",
                 ScopeName = "openid"
             }
         };
         context.ConsentScopes.AddRange(consentScopes);
     }
 }
 private static void InsertClients(SimpleIdentityServerContext context)
 {
     if (!context.Clients.Any())
     {
         context.Clients.AddRange(new[]
         {
             // Simple Identity server test client
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "CustomerPortal",
                 ClientName    = "Simple Identity Server Client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "CustomerPortal"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "openid"
                     },
                     new ClientScope
                     {
                         ScopeName = "role"
                     },
                     new ClientScope
                     {
                         ScopeName = "profile"
                     },
                     new ClientScope
                     {
                         ScopeName = Constants.RfidScopes.Card
                     }
                 },
                 GrantTypes               = "1",
                 ResponseTypes            = "0,1,2",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "http://localhost:5101/signin-oidc"
             }
         });
     }
 }
 private static void InsertClients(SimpleIdentityServerContext context)
 {
     if (!context.Clients.Any())
     {
         context.Clients.AddRange(new[]
         {
             // Resource manager website.
             new EF.Models.Client
             {
                 ClientId      = "RpEidWebsite",
                 ClientName    = "RpEid website",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "RpEidWebsite"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_basic,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 PolicyUri    = "http://openid.net",
                 TosUri       = "http://openid.net",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "openid"
                     },
                     new ClientScope
                     {
                         ScopeName = "role"
                     },
                     new ClientScope
                     {
                         ScopeName = "profile"
                     }
                 },
                 GrantTypes               = "1,4",
                 ResponseTypes            = "0,1,2",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "http://localhost:60005/callback",
                 PostLogoutRedirectUris   = "http://localhost:60005/end_session"
             }
         });
     }
 }
Exemple #17
0
 private static void InsertResourceOwners(SimpleIdentityServerContext context)
 {
     if (!context.ResourceOwners.Any())
     {
         context.ResourceOwners.AddRange(new[]
         {
             new ResourceOwner
             {
                 Id     = Guid.NewGuid().ToString(),
                 Claims = new List <ResourceOwnerClaim>
                 {
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Subject,
                         Value     = "administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Name,
                         Value     = "Thierry Habart"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Picture,
                         Value     = "http://*****:*****@hotmail.fr"
                     }
                 },
                 Password       = ComputeHash("password"),
                 IsLocalAccount = true
             }
         });
     }
 }
Exemple #18
0
 public static void EnsureSeedData(this SimpleIdentityServerContext context)
 {
     InsertClaims(context);
     InsertResourceOwners(context);
     InsertScopes(context);
     InsertTranslations(context);
     InsertJsonWebKeys(context);
     InsertClients(context);
     try
     {
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         string s = "";
     }
 }
Exemple #19
0
        private static void InsertJsonWebKeys(SimpleIdentityServerContext context)
        {
            if (!context.JsonWebKeys.Any())
            {
                var serializedRsa = string.Empty;
                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    using (var provider = new RSACryptoServiceProvider())
                    {
                        serializedRsa = provider.ToXmlStringNetCore(true);
                    }
                }
                else
                {
                    using (var rsa = new RSAOpenSsl())
                    {
                        serializedRsa = rsa.ToXmlStringNetCore(true);
                    }
                }

                context.JsonWebKeys.AddRange(new[]
                {
                    new JsonWebKey
                    {
                        Alg           = AllAlg.RS256,
                        KeyOps        = "0,1",
                        Kid           = "1",
                        Kty           = KeyType.RSA,
                        Use           = Use.Sig,
                        SerializedKey = serializedRsa,
                    },
                    new JsonWebKey
                    {
                        Alg           = AllAlg.RSA1_5,
                        KeyOps        = "2,3",
                        Kid           = "2",
                        Kty           = KeyType.RSA,
                        Use           = Use.Enc,
                        SerializedKey = serializedRsa,
                    }
                });
            }
        }
 private static void InsertResourceOwners(SimpleIdentityServerContext context)
 {
     if (!context.ResourceOwners.Any())
     {
         context.ResourceOwners.AddRange(new[]
         {
             new ResourceOwner
             {
                 Id     = Guid.NewGuid().ToString(),
                 Claims = new List <ResourceOwnerClaim>
                 {
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Subject,
                         Value     = "4BF95273"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Name,
                         Value     = "Thierry Habart"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Constants.CardClaims.CardNumber,
                         Value     = "4BF95273"
                     }
                 },
                 Password       = ComputeHash("password"),
                 IsLocalAccount = true
             }
         });
     }
 }
Exemple #21
0
 private static void InsertScopes(SimpleIdentityServerContext context)
 {
     if (!context.Scopes.Any())
     {
         context.Scopes.AddRange(new[] {
             new Scope
             {
                 Name                 = "uma_protection",
                 Description          = "Access to UMA permission, resource set & token introspection endpoints",
                 IsOpenIdScope        = false,
                 IsDisplayedInConsent = true,
                 Type                 = ScopeType.ProtectedApi
             },
             new Scope
             {
                 Name                 = "uma_authorization",
                 Description          = "Access to the UMA authorization endpoint",
                 IsOpenIdScope        = false,
                 IsDisplayedInConsent = true,
                 Type                 = ScopeType.ProtectedApi
             }
         });
     }
 }
Exemple #22
0
        private static void InsertJsonWebKeys(SimpleIdentityServerContext context, SharedContext sharedContext)
        {
            if (!context.JsonWebKeys.Any())
            {
                var serializedRsa = string.Empty;
#if NET461
                using (var provider = new RSACryptoServiceProvider())
                {
                    serializedRsa = provider.ToXmlString(true);
                }
#else
                using (var rsa = new RSAOpenSsl())
                {
                    serializedRsa = rsa.ToXmlString(true);
                }
#endif

                context.JsonWebKeys.AddRange(new[]
                {
                    sharedContext.ModelEncryptionKey,
                    sharedContext.ModelSignatureKey
                });
            }
        }
 private static void InsertResourceOwners(SimpleIdentityServerContext context)
 {
     if (!context.ResourceOwners.Any())
     {
         context.ResourceOwners.AddRange(new[]
         {
             new ResourceOwner
             {
                 Id     = "administrator",
                 Claims = new List <ResourceOwnerClaim>
                 {
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Subject,
                         Value     = "administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Role,
                         Value     = "administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Address,
                         Value     = "{ country : 'france' }"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.BirthDate,
                         Value     = "1989-10-07"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Email,
                         Value     = "*****@*****.**"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.EmailVerified,
                         Value     = "true"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.FamilyName,
                         Value     = "habart"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Gender,
                         Value     = "M"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.GivenName,
                         Value     = "Habart Thierry"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Locale,
                         Value     = "fr-FR"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.MiddleName,
                         Value     = "Thierry"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.NickName,
                         Value     = "Titi"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.PhoneNumber,
                         Value     = "+32485350536"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.PhoneNumberVerified,
                         Value     = "true"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Picture,
                         Value     = "https://upload.wikimedia.org/wikipedia/commons/thumb/5/58/Shiba_inu_taiki.jpg/220px-Shiba_inu_taiki.jpg"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.PreferredUserName,
                         Value     = "Thierry"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Profile,
                         Value     = "http://localhost/profile"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.UpdatedAt,
                         Value     = DateTime.Now.ConvertToUnixTimestamp().ToString()
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.WebSite,
                         Value     = "https://github.com/thabart"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.ZoneInfo,
                         Value     = "Europe/Paris"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.ScimId,
                         Value     = "id"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.ScimLocation,
                         Value     = "http://localhost:5555/Users/id"
                     }
                 },
                 Password       = "******",
                 IsLocalAccount = true
             }
         });
     }
 }
 private static void InsertScopes(SimpleIdentityServerContext context)
 {
     if (!context.Scopes.Any())
     {
         context.Scopes.AddRange(new[] {
             new Scope
             {
                 Name                 = "openid",
                 IsExposed            = true,
                 IsOpenIdScope        = true,
                 IsDisplayedInConsent = true,
                 Description          = "access to the openid scope",
                 Type                 = ScopeType.ProtectedApi
             },
             new Scope
             {
                 Name          = "profile",
                 IsExposed     = true,
                 IsOpenIdScope = true,
                 Description   = "Access to the profile",
                 ScopeClaims   = new List <ScopeClaim>
                 {
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Name
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.FamilyName
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.GivenName
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.MiddleName
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.NickName
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.PreferredUserName
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Profile
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Picture
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.WebSite
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Gender
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.BirthDate
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.ZoneInfo
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Locale
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.UpdatedAt
                     }
                 },
                 Type = ScopeType.ResourceOwner,
                 IsDisplayedInConsent = true
             },
             new Scope
             {
                 Name          = "scim",
                 IsExposed     = true,
                 IsOpenIdScope = true,
                 Description   = "Access to the scim",
                 ScopeClaims   = new List <ScopeClaim>
                 {
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.ScimId
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.ScimLocation
                     }
                 },
                 Type = ScopeType.ResourceOwner,
                 IsDisplayedInConsent = true
             },
             new Scope
             {
                 Name                 = "email",
                 IsExposed            = true,
                 IsOpenIdScope        = true,
                 IsDisplayedInConsent = true,
                 Description          = "Access to the email",
                 ScopeClaims          = new List <ScopeClaim>
                 {
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Email
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.EmailVerified
                     }
                 },
                 Type = ScopeType.ResourceOwner
             },
             new Scope
             {
                 Name                 = "address",
                 IsExposed            = true,
                 IsOpenIdScope        = true,
                 IsDisplayedInConsent = true,
                 Description          = "Access to the address",
                 ScopeClaims          = new List <ScopeClaim>
                 {
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Address
                     }
                 },
                 Type = ScopeType.ResourceOwner
             },
             new Scope
             {
                 Name                 = "phone",
                 IsExposed            = true,
                 IsOpenIdScope        = true,
                 IsDisplayedInConsent = true,
                 Description          = "Access to the phone",
                 ScopeClaims          = new List <ScopeClaim>
                 {
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.PhoneNumber
                     },
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.PhoneNumberVerified
                     }
                 },
                 Type = ScopeType.ResourceOwner
             },
             new Scope
             {
                 Name                 = "role",
                 IsExposed            = true,
                 IsOpenIdScope        = false,
                 IsDisplayedInConsent = true,
                 Description          = "Access to your roles",
                 ScopeClaims          = new List <ScopeClaim>
                 {
                     new ScopeClaim {
                         ClaimCode = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Role
                     }
                 },
                 Type = ScopeType.ResourceOwner
             },
             new Scope
             {
                 Name                 = "api1",
                 IsExposed            = false,
                 IsOpenIdScope        = false,
                 IsDisplayedInConsent = true,
                 Description          = "Access to your api1",
                 Type                 = ScopeType.ProtectedApi
             }
         });
     }
 }
Exemple #25
0
 private static void InsertClients(SimpleIdentityServerContext context)
 {
     if (!context.Clients.Any())
     {
         context.Clients.AddRange(new[]
         {
             new Client
             {
                 ClientId      = "MobileApp",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "YDVp0aKM_~r3HYM"
                     }
                 },
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "openid"
                     },
                     new ClientScope
                     {
                         ScopeName = "scim"
                     },
                     new ClientScope
                     {
                         ScopeName = "role"
                     }
                 },
                 ClientName = "Mobile application",
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post,
                 LogoUri         = "http://www.corelynx.com/sites/default/files/technologies/mobile-application.png",
                 PolicyUri       = "http://openid.net",
                 TosUri          = "http://openid.net",
                 ApplicationType = ApplicationTypes.web,
                 GrantTypes      = "0,1,2,4",
                 ResponseTypes   = "0,1,2"
             },
             new Client
             {
                 ClientId      = "ResourceManagerClientId",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "ResourceManagerClientId"
                     }
                 },
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "openid"
                     },
                     new ClientScope
                     {
                         ScopeName = "profile"
                     },
                     new ClientScope
                     {
                         ScopeName = "role"
                     },
                     new ClientScope
                     {
                         ScopeName = "scim"
                     }
                 },
                 ClientName = "Website",
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_basic,
                 LogoUri                = "",
                 PolicyUri              = "http://openid.net",
                 TosUri                 = "http://openid.net",
                 ApplicationType        = ApplicationTypes.web,
                 RedirectionUrls        = "http://localhost:64950/callback",
                 PostLogoutRedirectUris = "http://localhost:64950/end_session",
                 GrantTypes             = "0,1,2,4",
                 ResponseTypes          = "0,1,2"
             }
         });
     }
 }
Exemple #26
0
 private static void InsertTranslations(SimpleIdentityServerContext context)
 {
     if (!context.Translations.Any())
     {
         context.Translations.AddRange(new[] {
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.ApplicationWouldLikeToCode,
                 Value       = "the client {0} would like to access"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.IndividualClaimsCode,
                 Value       = "individual claims"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.NameCode,
                 Value       = "Name"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.LoginCode,
                 Value       = "Login"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.PasswordCode,
                 Value       = "Password"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.UserNameCode,
                 Value       = "Username"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.ConfirmCode,
                 Value       = "Confirm"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.CancelCode,
                 Value       = "Cancel"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.LoginLocalAccount,
                 Value       = "Login with your local account"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.LoginExternalAccount,
                 Value       = "Login with your external account"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.LinkToThePolicy,
                 Value       = "policy"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.Tos,
                 Value       = "Terms of Service"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.SendCode,
                 Value       = "Send code"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.Code,
                 Value       = "Code"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.EditResourceOwner,
                 Value       = "Edit resource owner"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.YourName,
                 Value       = "Your name"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.YourPassword,
                 Value       = "Your password"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.Email,
                 Value       = "Email"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.YourEmail,
                 Value       = "Your email"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.TwoAuthenticationFactor,
                 Value       = "Two authentication factor"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.UserIsUpdated,
                 Value       = "User has been updated"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.SendConfirmationCode,
                 Value       = "Send a confirmation code"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.Phone,
                 Value       = "Phone"
             },
             new Translation
             {
                 LanguageTag = "en",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.HashedPassword,
                 Value       = "Hashed password"
             },
             // French
             new Translation
             {
                 LanguageTag = "fr",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.ApplicationWouldLikeToCode,
                 Value       = "L'application veut accéder à:"
             },
             new Translation
             {
                 LanguageTag = "fr",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.IndividualClaimsCode,
                 Value       = "Les claims"
             },
             new Translation
             {
                 LanguageTag = "fr",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.YourName,
                 Value       = "S'authentifier"
             },
             new Translation
             {
                 LanguageTag = "fr",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.PasswordCode,
                 Value       = "Mot de passe"
             },
             new Translation
             {
                 LanguageTag = "fr",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.UserNameCode,
                 Value       = "Nom d'utilisateur"
             },
             new Translation
             {
                 LanguageTag = "fr",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.ConfirmCode,
                 Value       = "confirmer"
             },
             new Translation
             {
                 LanguageTag = "fr",
                 Code        = SimpleIdentityServer.Core.Constants.StandardTranslationCodes.CancelCode,
                 Value       = "annuler"
             }
         });
     }
 }
Exemple #27
0
 public ResourceOwnerCredentialRepository(SimpleIdentityServerContext context)
 {
     _context = context;
 }
 private static void InsertClaims(SimpleIdentityServerContext context)
 {
     if (!context.Claims.Any())
     {
         context.Claims.AddRange(new[] {
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Subject, IsIdentifier = true
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Name
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.FamilyName
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.GivenName
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.MiddleName
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.NickName
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.PreferredUserName
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Profile
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Picture
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.WebSite
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Gender
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.BirthDate
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.ZoneInfo
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Locale
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.UpdatedAt
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Email
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.EmailVerified
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Address
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.PhoneNumber
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.PhoneNumberVerified
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.Role
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.ScimId
             },
             new Claim {
                 Code = Core.Jwt.Constants.StandardResourceOwnerClaimNames.ScimLocation
             }
         });
     }
 }
 private static void InsertClients(SimpleIdentityServerContext context, SharedContext sharedCtx)
 {
     if (!context.Clients.Any())
     {
         context.Clients.AddRange(new[]
         {
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "client",
                 ClientName    = "client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "client"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 PolicyUri    = "http://openid.net",
                 TosUri       = "http://openid.net",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "openid"
                     },
                     new ClientScope
                     {
                         ScopeName = "role"
                     },
                     new ClientScope
                     {
                         ScopeName = "profile"
                     },
                     new ClientScope
                     {
                         ScopeName = "scim"
                     }
                 },
                 GrantTypes               = "4",
                 ResponseTypes            = "0,1,2",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "https://localhost:4200/callback"
             },
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "basic_client",
                 ClientName    = "basic_client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "basic_client"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_basic,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 PolicyUri    = "http://openid.net",
                 TosUri       = "http://openid.net",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "api1"
                     }
                 },
                 GrantTypes               = "3",
                 ResponseTypes            = "1",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "https://localhost:4200/callback"
             },
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "post_client",
                 ClientName    = "post_client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "post_client"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 PolicyUri    = "http://openid.net",
                 TosUri       = "http://openid.net",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "api1"
                     }
                 },
                 GrantTypes               = "3",
                 ResponseTypes            = "1",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "https://localhost:4200/callback"
             },
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "jwt_client",
                 ClientName    = "jwt_client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "jwt_client"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_jwt,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 PolicyUri    = "http://openid.net",
                 TosUri       = "http://openid.net",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "api1"
                     }
                 },
                 GrantTypes               = "3",
                 ResponseTypes            = "1",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "https://localhost:4200/callback",
                 JsonWebKeys              = new List <JsonWebKey>
                 {
                     sharedCtx.ModelSignatureKey,
                     sharedCtx.ModelEncryptionKey
                 }
             },
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "private_key_client",
                 ClientName    = "private_key_client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "private_key_client"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.private_key_jwt,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 PolicyUri    = "http://openid.net",
                 TosUri       = "http://openid.net",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "api1"
                     }
                 },
                 GrantTypes               = "3",
                 ResponseTypes            = "1",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "https://localhost:4200/callback",
                 JwksUri = "http://localhost:5000/jwks_client"
             },
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "authcode_client",
                 ClientName    = "authcode_client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "authcode_client"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 PolicyUri    = "http://openid.net",
                 TosUri       = "http://openid.net",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "api1"
                     },
                     new ClientScope
                     {
                         ScopeName = "openid"
                     }
                 },
                 GrantTypes               = "0",
                 ResponseTypes            = "0,1,2",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "http://localhost:5000/callback"
             },
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "implicit_client",
                 ClientName    = "implicit_client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "implicit_client"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 PolicyUri    = "http://openid.net",
                 TosUri       = "http://openid.net",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "api1"
                     },
                     new ClientScope
                     {
                         ScopeName = "openid"
                     }
                 },
                 GrantTypes               = "1",
                 ResponseTypes            = "1,2",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "http://localhost:5000/callback"
             },
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "pkce_client",
                 ClientName    = "pkce_client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "pkce_client"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 PolicyUri    = "http://openid.net",
                 TosUri       = "http://openid.net",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "api1"
                     },
                     new ClientScope
                     {
                         ScopeName = "openid"
                     }
                 },
                 GrantTypes               = "0",
                 ResponseTypes            = "0,1,2",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "http://localhost:5000/callback",
                 RequirePkce              = true
             },
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "hybrid_client",
                 ClientName    = "hybrid_client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.SharedSecret,
                         Value = "hybrid_client"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 PolicyUri    = "http://openid.net",
                 TosUri       = "http://openid.net",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "api1"
                     },
                     new ClientScope
                     {
                         ScopeName = "openid"
                     }
                 },
                 GrantTypes               = "0,1",
                 ResponseTypes            = "0,1,2",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.web,
                 RedirectionUrls          = "http://localhost:5000/callback"
             },
             // Certificate test client.
             new DataAccess.SqlServer.Models.Client
             {
                 ClientId      = "certificate_client",
                 ClientName    = "Certificate test client",
                 ClientSecrets = new List <ClientSecret>
                 {
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.X509Thumbprint,
                         Value = "470543E0FC19F3D4355457A8C22E78919EA9AA66"
                     },
                     new ClientSecret
                     {
                         Id    = Guid.NewGuid().ToString(),
                         Type  = SecretTypes.X509Name,
                         Value = "CN=localhost"
                     }
                 },
                 TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.tls_client_auth,
                 LogoUri      = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg",
                 ClientScopes = new List <ClientScope>
                 {
                     new ClientScope
                     {
                         ScopeName = "openid"
                     }
                 },
                 GrantTypes               = "4",
                 ResponseTypes            = "1,2",
                 IdTokenSignedResponseAlg = "RS256",
                 ApplicationType          = ApplicationTypes.native
             }
         });
     }
 }
 private static void InsertResourceOwners(SimpleIdentityServerContext context)
 {
     if (!context.ResourceOwners.Any())
     {
         context.ResourceOwners.AddRange(new[]
         {
             new ResourceOwner
             {
                 Id     = "administrator",
                 Claims = new List <ResourceOwnerClaim>
                 {
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Subject,
                         Value     = "administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Role,
                         Value     = "administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Address,
                         Value     = "{ country : 'belgique' }"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.BirthDate,
                         Value     = "1900-01-01"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Email,
                         Value     = "*****@*****.**"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.EmailVerified,
                         Value     = "true"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.FamilyName,
                         Value     = "administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Gender,
                         Value     = "M"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.GivenName,
                         Value     = "Administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Locale,
                         Value     = "fr-FR"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.MiddleName,
                         Value     = "Administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.NickName,
                         Value     = "Admin"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.PhoneNumber,
                         Value     = "+32444444444"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.PhoneNumberVerified,
                         Value     = "true"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Picture,
                         Value     = "http://localhost:60000/img/Unknown.png"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.PreferredUserName,
                         Value     = "Administrator"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.Profile,
                         Value     = "http://localhost/profile"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.UpdatedAt,
                         Value     = DateTime.Now.ConvertToUnixTimestamp().ToString()
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.WebSite,
                         Value     = "https://github.com/thabart"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.ZoneInfo,
                         Value     = "Europe/Paris"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.ScimId,
                         Value     = "id"
                     },
                     new ResourceOwnerClaim
                     {
                         Id        = Guid.NewGuid().ToString(),
                         ClaimCode = SimpleIdentityServer.Core.Jwt.Constants.StandardResourceOwnerClaimNames.ScimLocation,
                         Value     = "http://localhost:5555/Users/id"
                     }
                 },
                 Password       = "******",
                 IsLocalAccount = true
             }
         });
     }
 }