示例#1
0
        public async Task CreateNewClient(string clientId, string clientName, string description, int familyId, ClientType clientType)
        {
            var outbackClient = new OutbackClient
            {
                ClientId       = clientId,
                ClientType     = clientType,
                Description    = description,
                Name           = clientName,
                ClientFamilyId = familyId
            };

            await _outbackDbContext.AddAsync(outbackClient);

            await _outbackDbContext.SaveChangesAsync();
        }
示例#2
0
        private async Task <Credentials> CreateInnovationBoostWebClient()
        {
            if (await _outbackDbContext.Clients.AnyAsync(m => m.Name == "InnovationBoost"))
            {
                return(new Credentials());
            }

            var clientFamily = await _outbackDbContext.ClientFamilies.SingleAsync(m => m.Name == "WebApplication");

            var secret = GetClientSecret();

            var client = new OutbackClient
            {
                ClientFamilyId      = clientFamily.Id,
                ClientId            = GetClientId(),
                ClientType          = Rinsen.Outback.Clients.ClientType.Confidential,
                Name                = "InnovationBoost",
                SupportedGrantTypes = new List <OutbackClientSupportedGrantType>
                {
                    new OutbackClientSupportedGrantType {
                        GrantType = "client_credentials"
                    }
                },
                Secrets = new List <OutbackClientSecret>
                {
                    new OutbackClientSecret
                    {
                        Description = "Initial secret created by installer",
                        Secret      = HashHelper.GetSha256Hash(secret),
                    }
                },
                Scopes = new List <OutbackClientScope>()
            };

            await _outbackDbContext.AddAsync(client);

            await _outbackDbContext.SaveChangesAsync();

            return(new Credentials
            {
                ClientId = client.ClientId,
                Secret = secret
            });
        }