@using Phoenix.IdentityServerAdmin.Clients.Dtos
@using IdentityServer4.Models
<EditForm Model="ClientSecretList">
<Card>
<CardBody>
@foreach (var clientSecret in ClientSecretList)
{
<Card Class="mb-2">
<CardBody>
<div class="form-group row">
<label class="col-sm-2">Secret Type</label>
<div class="col-sm-10">
<Select @bind-SelectedValue="clientSecret.Type"
@onchange="@((e)=>
{
clientSecret.Type = e.Value.ToString();
})">
<SelectItem Value="@("SharedSecret")">Shared Secret</SelectItem>
</Select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2">Secret Value</label>
<div class="col-sm-10">
<TextEdit @bind-Text="clientSecret.Value"
@onchange="@((e) => {
clientSecret.Value = e.Value.ToString().Sha256();
})">
</TextEdit>
<small class="form-text text-danger">
Attension:Input value will encode with sha256.
</small>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2">Description</label>
<div class="col-sm-10">
<TextEdit @bind-Text="clientSecret.Description"
@onchange="@((e)=>
{
clientSecret.Description = e.Value.ToString();
})"></TextEdit>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2">Expiration</label>
<div class="col-sm-10">
<DateEdit @bind-Date="clientSecret.Expiration"
@onchange="@((e)=>
{
if ( e.Value!=null)
{
clientSecret.Expiration =DateTime.Parse( e.Value.ToString());
}
})"></DateEdit>
</div>
</div>
</CardBody>
<CardFooter>
<Button Color="Color.Danger" Clicked="() =>
{ ClientSecretList.Remove(clientSecret);
ClientSecretListChanged.InvokeAsync(ClientSecretList);
}">
Delete
</Button>
</CardFooter>
</Card>}
</CardBody>
<CardFooter>
<Button Color="Color.Primary"
Clicked="@(() => { ClientSecretList.Add(new ClientSecretDto()); ClientSecretListChanged.InvokeAsync(ClientSecretList); })">
New Secret
</Button>
</CardFooter>
</Card>
</EditForm>
@code { [Parameter]
public List<ClientSecretDto> ClientSecretList { get; set; } = new List<ClientSecretDto>();
[Parameter]
public EventCallback<List<ClientSecretDto>> ClientSecretListChanged { get; set; } }