-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #403
- Loading branch information
github-actions
committed
Apr 1, 2021
1 parent
f5cd52e
commit 0295b1f
Showing
18 changed files
with
315 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
...heIdServer.BlazorApp.Pages.ExternalProvider/Components/WsFederationOptionsComponent.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
@inherits ProviderOptionsBase<WsFederationOptions> | ||
|
||
<div class="form-group row"> | ||
<label class="col col-form-label" for="metadataAddress"> | ||
@Localizer["metadata address"] | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeText Id="metadataAddress" Placeholder="https://<ADFS FQDN or AAD tenant>/FederationMetadata/2007-06/FederationMetadata.xml" @bind-Value="@Model.Options.MetadataAddress" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="wtrealm"> | ||
@Localizer["wtrealm "] | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeText Id="wtrealm" Placeholder="https://<Application ID URI>" @bind-Value="@Model.Options.Wtrealm" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="wreply"> | ||
@Localizer["wreply "] | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeText Id="wreply" @bind-Value="@Model.Options.Wreply" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="signOutWreply"> | ||
@Localizer["sign-out wreply "] | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeText Id="signOutWreply" @bind-Value="@Model.Options.SignOutWreply" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="signOutScheme"> | ||
@Localizer["sign-out scheme "] | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeText Id="signOutScheme" @bind-Value="@Model.Options.SignOutScheme" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="remoteSignOutPath"> | ||
@Localizer["remote sign-out path "] | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeText Id="remoteSignOutPath" Placeholder="/sign-out" @bind-Value="@Model.Options.RemoteSignOutPath" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="requireHttpsMetadata"> | ||
</label> | ||
<div id="require-https" class="col-lg-10 col-sm-12"> | ||
<AuthorizeCheckbox Name="requireHttpsMetadata" Label="@Localizer["require https metadata"]" @bind-Value="@RequireHttpsMetadata" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="saveTokens"> | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeCheckbox Name="saveTokens" Label="@Localizer["save tokens"]" @bind-Value="@Model.Options.SaveTokens" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="useTokenLifetime"> | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeCheckbox Name="useTokenLifetime" Label="@Localizer["use token lifetime"]" @bind-Value="@Model.Options.UseTokenLifetime" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="skipUnrecognizedRequests"> | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeCheckbox Name="skipUnrecognizedRequests" Label="@Localizer["skip unrecognized requests"]" @bind-Value="@Model.Options.SkipUnrecognizedRequests" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="refreshOnIssuerKeyNotFound"> | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeCheckbox Name="refreshOnIssuerKeyNotFound" Label="@Localizer["refresh on issuer key not found"]" @bind-Value="@Model.Options.RefreshOnIssuerKeyNotFound" /> | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<label class="col col-form-label" for="allowUnsolicitedLogins"> | ||
</label> | ||
<div class="col-lg-10 col-sm-12"> | ||
<AuthorizeCheckbox Name="allowUnsolicitedLogins" Label="@Localizer["allow unsolicited logins"]" @bind-Value="@Model.Options.AllowUnsolicitedLogins" /> | ||
</div> | ||
</div> | ||
|
||
|
22 changes: 22 additions & 0 deletions
22
...dServer.BlazorApp.Pages.ExternalProvider/Components/WsFederationOptionsComponent.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Project: Aguafrommars/TheIdServer | ||
// Copyright (c) 2021 @Olivier Lefebvre | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.AspNetCore.Components.Forms; | ||
|
||
namespace Aguacongas.TheIdServer.BlazorApp.Pages.ExternalProvider.Components | ||
{ | ||
public partial class WsFederationOptionsComponent | ||
{ | ||
[CascadingParameter] | ||
public EditContext EditContext { get; set; } | ||
|
||
public bool RequireHttpsMetadata { | ||
get => Model.Options.RequireHttpsMetadata; | ||
set | ||
{ | ||
Model.Options.RequireHttpsMetadata = value; | ||
EditContext.NotifyFieldChanged(new FieldIdentifier(Model.Options, nameof(Model.Options.MetadataAddress))); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
...App/Aguacongas.TheIdServer.BlazorApp.Pages.ExternalProvider/Models/WsFederationOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// Project: Aguafrommars/TheIdServer | ||
// Copyright (c) 2021 @Olivier Lefebvre | ||
|
||
namespace Aguacongas.TheIdServer.BlazorApp.Models | ||
{ | ||
|
||
/// <summary> | ||
/// WS-Federation options | ||
/// </summary> | ||
/// <seealso cref="RemoteAuthenticationOptions" /> | ||
public class WsFederationOptions : RemoteAuthenticationOptions | ||
{ | ||
/// <summary> | ||
/// Requests received on this path will cause the handler to invoke SignOut using | ||
/// the SignOutScheme. | ||
/// </summary> | ||
/// <value> | ||
/// The remote sign out path. | ||
/// </value> | ||
public string RemoteSignOutPath { get; set; } | ||
|
||
/// <summary> | ||
/// The Ws-Federation protocol allows the user to initiate logins without contacting | ||
/// the application for a Challenge first. However, that flow is susceptible to XSRF | ||
/// and other attacks so it is disabled here by default. | ||
/// </summary> | ||
/// <value> | ||
/// <c>true</c> if [allow unsolicited logins]; otherwise, <c>false</c>. | ||
/// </value> | ||
public bool AllowUnsolicitedLogins { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets if HTTPS is required for the metadata address or authority. The | ||
/// default is true. This should be disabled only in development environments. | ||
/// </summary> | ||
/// <value> | ||
/// <c>true</c> if [require HTTPS metadata]; otherwise, <c>false</c>. | ||
/// </value> | ||
public bool RequireHttpsMetadata { get; set; } | ||
|
||
/// <summary> | ||
/// Indicates that the authentication session lifetime (e.g. cookies) should match | ||
/// that of the authentication token. If the token does not provide lifetime information | ||
/// then normal session lifetimes will be used. This is enabled by default. | ||
/// </summary> | ||
/// <value> | ||
/// <c>true</c> if [use token lifetime]; otherwise, <c>false</c>. | ||
/// </value> | ||
public bool UseTokenLifetime { get; set; } | ||
/// <summary> | ||
/// Gets or sets the 'wtrealm'. | ||
/// </summary> | ||
/// <value> | ||
/// The wtrealm. | ||
/// </value> | ||
public string Wtrealm { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the 'wreply' value used during sign-out. If none is specified then | ||
/// the value from the Wreply field is used. | ||
/// </summary> | ||
/// <value> | ||
/// The sign out wreply. | ||
/// </value> | ||
public string SignOutWreply { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the 'wreply'. CallbackPath must be set to match or cleared so it | ||
/// can be generated dynamically. This field is optional. If not set then it will | ||
/// be generated from the current request and the CallbackPath. | ||
/// </summary> | ||
/// <value> | ||
/// The wreply. | ||
/// </value> | ||
public string Wreply { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Indicates if requests to the CallbackPath may also be for other components. If | ||
/// enabled the handler will pass requests through that do not contain WsFederation | ||
/// authentication responses. Disabling this and setting the CallbackPath to a dedicated | ||
/// endpoint may provide better error handling. This is disabled by default. | ||
/// </summary> | ||
/// <value> | ||
/// <c>true</c> if [skip unrecognized requests]; otherwise, <c>false</c>. | ||
/// </value> | ||
public bool SkipUnrecognizedRequests { get; set; } | ||
/// <summary> | ||
/// Gets or sets if a metadata refresh should be attempted after a SecurityTokenSignatureKeyNotFoundException. | ||
/// This allows for automatic recovery in the event of a signature key rollover. | ||
/// This is enabled by default. | ||
/// </summary> | ||
/// <value> | ||
/// <c>true</c> if [refresh on issuer key not found]; otherwise, <c>false</c>. | ||
/// </value> | ||
public bool RefreshOnIssuerKeyNotFound { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the address to retrieve the wsFederation metadata | ||
/// </summary> | ||
/// <value> | ||
/// The metadata address. | ||
/// </value> | ||
public string MetadataAddress { get; set; } | ||
|
||
/// <summary> | ||
/// The Authentication Scheme to use with SignOutAsync from RemoteSignOutPath. SignInScheme | ||
/// will be used if this is not set. | ||
/// </summary> | ||
/// <value> | ||
/// The sign out scheme. | ||
/// </value> | ||
public string SignOutScheme { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...s.TheIdServer.BlazorApp.Pages.ExternalProvider/Validators/WsFederationOptionsValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Project: Aguafrommars/TheIdServer | ||
// Copyright (c) 2021 @Olivier Lefebvre | ||
using Aguacongas.TheIdServer.BlazorApp.Models; | ||
using FluentValidation; | ||
using Microsoft.Extensions.Localization; | ||
|
||
namespace Aguacongas.TheIdServer.BlazorApp.Validators | ||
{ | ||
public class WsFederationOptionsValidator : AbstractValidator<WsFederationOptions> | ||
{ | ||
public WsFederationOptionsValidator(ExternalProvider _, IStringLocalizer localizer) | ||
{ | ||
RuleFor(m => m.MetadataAddress).NotEmpty().WithMessage(localizer["Metadata address is required."]); | ||
RuleFor(m => m.MetadataAddress).Uri().WithMessage(localizer["Metadata address must be a valid uri."]); | ||
RuleFor(m => m.MetadataAddress).Must((options, value) => !options.RequireHttpsMetadata || value.ToUpperInvariant().StartsWith("HTTPS")) | ||
.WithMessage(localizer["Metadata address must be a valid HTTPS url when 'required https metadata is true'."]); | ||
RuleFor(m => m.Wtrealm).NotEmpty().WithMessage(localizer["Wtrealm is required."]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.