示例#1
0
 /// <summary>
 /// 删除客户端信息
 /// </summary>
 /// <param name="id">客户端编号</param>
 /// <returns>业务操作结果</returns>
 public virtual Task <OperationResult> DeleteClient(TClientKey id)
 {
     return(ClientRepository.DeleteAsync(new[] { id },
                                         null,
                                         entity =>
     {
         foreach (TClientSecret secret in entity.ClientSecrets)
         {
             ClientSecretRepository.Delete(secret);
         }
         return Task.FromResult(entity);
     }));
 }
示例#2
0
 /// <summary>
 /// 新增客户端密钥信息
 /// </summary>
 /// <param name="dto">客户端密钥信息输入DTO</param>
 /// <returns>业务操作结果</returns>
 public virtual Task <OperationResult> CreateClientSecret(TClientSecretInputDto dto)
 {
     dto.CheckNotNull("dto");
     return(ClientSecretRepository.InsertAsync(new[] { dto },
                                               null,
                                               async(_, entity) =>
     {
         //生成密钥
         entity.Value = IoAuthClientSecretProvider.CreateSecret();
         TClient client = await ClientRepository.GetByKeyAsync(dto.ClientId);
         if (client == null)
         {
             throw new Exception("指定编号的客户端信息不存在");
         }
         entity.Client = client;
         return entity;
     }));
 }
示例#3
0
 /// <summary>
 /// 删除客户端密钥信息
 /// </summary>
 /// <param name="id">客户端密钥编号</param>
 /// <returns>业务操作结果</returns>
 public virtual Task <OperationResult> DeleteClientSecret(TClientSecretKey id)
 {
     return(ClientSecretRepository.DeleteAsync(new[] { id }));
 }
示例#4
0
 /// <summary>
 /// 编辑客户端密钥信息
 /// </summary>
 /// <param name="dto">客户端密钥信息输入DTO</param>
 /// <returns>业务操作结果</returns>
 public virtual Task <OperationResult> UpdateClientSecret(TClientSecretInputDto dto)
 {
     dto.CheckNotNull("dto");
     return(ClientSecretRepository.UpdateAsync(new[] { dto }));
 }