Skip to content

Commit

Permalink
fix: switch to ws-fed crash app
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Apr 10, 2023
1 parent 14195fa commit ce16e0e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
@inject IStringLocalizerAsync<ClientUrisPanel> Localizer
<div id="urls" class="card mb-3">
@if(Model.ProtocolType != "wsfed")
{
<div class="card-header">
<EntitySubGridTitle Text="URLs" Collection="@Model.RedirectUris" CreateModel="CreateRedirectUri" />
</div>
<div class="card-body">
<ClientUris Model="@Model" Collection="@Model.RedirectUris" />
</div>
}
else
{
<div class="card-header">
<div class="row">
<div class="col d-flex">
<span class="h5">URL</span>
@if (Model.ProtocolType != "wsfed")
{
<div class="card-header">
<EntitySubGridTitle Text="URLs" Collection="@Model.RedirectUris" CreateModel="CreateRedirectUri" />
</div>
<div class="card-body">
<ClientUris Model="@Model" Collection="@Model.RedirectUris" />
</div>
}
else
{
<div class="card-header">
<div class="row">
<div class="col d-flex">
<span class="h5">URL</span>
</div>
</div>
</div>
</div>
<div class="card-body">
<div class="mb-3 row">
<label class="col col-form-label" for="redirect-uri">
@Localizer["redirect uri"]
</label>
<div class="col-lg-10 col-sm-12">
<AuthorizeText Id="redirect-uri" Placeholder="https://wsfed.client.com" @bind-Value="@Model.RedirectUris.First().Uri" MaxLength="2000" />
<div class="card-body">
<div class="mb-3 row">
<label class="col col-form-label" for="redirect-uri">
@Localizer["redirect uri"]
</label>
<div class="col-lg-10 col-sm-12">
<AuthorizeText Id="redirect-uri" Placeholder="https://wsfed.client.com" @bind-Value="@WsFedRedirectUri" MaxLength="2000" />
</div>
</div>
</div>
</div>
}
}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@ namespace Aguacongas.TheIdServer.BlazorApp.Pages.Client.Components
{
public partial class ClientUrisPanel
{
string WsFedRedirectUri
{
get => Model.RedirectUris.FirstOrDefault()?.Uri;
set
{
var uri = Model.RedirectUris.FirstOrDefault();
if (uri is null)
{
uri = new Entity.ClientUri
{
Kind = Entity.UriKinds.Redirect,
Uri = value
};
Model.RedirectUris.Add(uri);
HandleModificationState.EntityCreated(uri);
return;
}

uri.Uri = value;
HandleModificationState.EntityUpdated(uri);
}
}

[Parameter]
public Entity.Client Model { get; set; }

Expand All @@ -18,15 +41,6 @@ public partial class ClientUrisPanel
protected override void OnInitialized()
{
HandleModificationState.OnStateChange += HandleModificationState_OnStateChange;
if (Model.ProtocolType == "wsfed" && !Model.RedirectUris.Any())
{
var uri = new Entity.ClientUri
{
Kind = Entity.UriKinds.Redirect
};
Model.RedirectUris.Add(uri);
HandleModificationState.EntityCreated(uri);
}
}

private void HandleModificationState_OnStateChange(ModificationKind kind, object entity)
Expand Down

0 comments on commit ce16e0e

Please sign in to comment.