Exemple #1
0
        /// <summary>
        /// Update the specified role.
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        public async Task <Models.RoleModel> UpdateRoleAsync(Models.RoleModel role)
        {
            var json     = role.Serialize();
            var content  = new StringContent(json, Encoding.UTF8, "application/json");
            var response = await _client.PutAsync($"{this.Options.Admin.Authority}/roles-by-id/{role.Id}", content);

            return(response.HandleResponse(role));
        }
Exemple #2
0
        /// <summary>
        /// Create a new role within the client specified by the 'clientId'.
        /// </summary>
        /// <param name="clientId"></param>
        /// <param name="role"></param>
        /// <returns></returns>
        public async Task <Models.RoleModel> CreateRoleAsync(Guid clientId, Models.RoleModel role)
        {
            var json     = role.Serialize();
            var content  = new StringContent(json, Encoding.UTF8, "application/json");
            var response = await _client.PostAsync($"{this.Options.Admin.Authority}/clients/{clientId}/roles", content);

            return(await response.HandleResponseAsync <Models.RoleModel>());
        }