1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-04 05:08:06 +02:00

Remove unused SSO Form code (#701)

* Remove unused SAML Artifact Binding properties

* Remove unused validators
This commit is contained in:
Thomas Rittson 2022-03-03 07:52:11 +10:00 committed by GitHub
parent 8f5f694a1e
commit adfc2f234d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 38 deletions

View File

@ -1,25 +1,8 @@
import { AbstractControl, ValidationErrors, ValidatorFn, Validators } from "@angular/forms";
import { requiredIf } from "./requiredIf.validator";
import { AbstractControl, ValidationErrors, Validators } from "@angular/forms";
/**
* A higher order function that takes a ValidatorFn and returns a new validator.
* The new validator only runs the ValidatorFn if the control is dirty. This prevents error messages from being
* displayed to the user prematurely.
*/
function dirtyValidator(validator: ValidatorFn) {
return (control: AbstractControl): ValidationErrors | null => {
return control.dirty ? validator(control) : null;
};
}
export function dirtyRequiredIf(predicate: (predicateCtrl: AbstractControl) => boolean) {
return dirtyValidator(requiredIf(predicate));
}
/**
* Equivalent to dirtyValidator(Validator.required), however using dirtyValidator returns a new function
* each time which prevents formControl.hasError from properly comparing functions for equality.
* Runs Validators.required on a field only if it's dirty. This prevents error messages from being displayed
* to the user prematurely.
*/
export function dirtyRequired(control: AbstractControl): ValidationErrors | null {
return control.dirty ? Validators.required(control) : null;

View File

@ -1,10 +0,0 @@
import { AbstractControl, ValidationErrors, Validators } from "@angular/forms";
/**
* Returns a new validator which will apply Validators.required only if the predicate is true.
*/
export function requiredIf(predicate: (predicateCtrl: AbstractControl) => boolean) {
return (control: AbstractControl): ValidationErrors | null => {
return predicate(control) ? Validators.required(control) : null;
};
}

View File

@ -12,7 +12,6 @@ export enum OpenIdConnectRedirectBehavior {
export enum Saml2BindingType {
HttpRedirect = 1,
HttpPost = 2,
Artifact = 4,
}
export enum Saml2NameIdFormat {

View File

@ -40,7 +40,6 @@ export class SsoConfigApi extends BaseResponse {
api.idpBindingType = view.saml.idpBindingType;
api.idpSingleSignOnServiceUrl = view.saml.idpSingleSignOnServiceUrl;
api.idpSingleLogoutServiceUrl = view.saml.idpSingleLogoutServiceUrl;
api.idpArtifactResolutionServiceUrl = view.saml.idpArtifactResolutionServiceUrl;
api.idpX509PublicCert = view.saml.idpX509PublicCert;
api.idpOutboundSigningAlgorithm = view.saml.idpOutboundSigningAlgorithm;
api.idpAllowUnsolicitedAuthnResponse = view.saml.idpAllowUnsolicitedAuthnResponse;
@ -83,7 +82,6 @@ export class SsoConfigApi extends BaseResponse {
idpBindingType: Saml2BindingType;
idpSingleSignOnServiceUrl: string;
idpSingleLogoutServiceUrl: string;
idpArtifactResolutionServiceUrl: string;
idpX509PublicCert: string;
idpOutboundSigningAlgorithm: string;
idpAllowUnsolicitedAuthnResponse: boolean;
@ -125,9 +123,6 @@ export class SsoConfigApi extends BaseResponse {
this.idpBindingType = this.getResponseProperty("IdpBindingType");
this.idpSingleSignOnServiceUrl = this.getResponseProperty("IdpSingleSignOnServiceUrl");
this.idpSingleLogoutServiceUrl = this.getResponseProperty("IdpSingleLogoutServiceUrl");
this.idpArtifactResolutionServiceUrl = this.getResponseProperty(
"IdpArtifactResolutionServiceUrl"
);
this.idpX509PublicCert = this.getResponseProperty("IdpX509PublicCert");
this.idpOutboundSigningAlgorithm = this.getResponseProperty("IdpOutboundSigningAlgorithm");
this.idpAllowUnsolicitedAuthnResponse = this.getResponseProperty(

View File

@ -42,7 +42,6 @@ export class SsoConfigView extends View {
idpBindingType: Saml2BindingType;
idpSingleSignOnServiceUrl: string;
idpSingleLogoutServiceUrl: string;
idpArtifactResolutionServiceUrl: string;
idpX509PublicCert: string;
idpOutboundSigningAlgorithm: string;
idpAllowUnsolicitedAuthnResponse: boolean;
@ -89,7 +88,6 @@ export class SsoConfigView extends View {
idpBindingType: api.idpBindingType,
idpSingleSignOnServiceUrl: api.idpSingleSignOnServiceUrl,
idpSingleLogoutServiceUrl: api.idpSingleLogoutServiceUrl,
idpArtifactResolutionServiceUrl: api.idpArtifactResolutionServiceUrl,
idpX509PublicCert: api.idpX509PublicCert,
idpOutboundSigningAlgorithm: api.idpOutboundSigningAlgorithm,
idpAllowUnsolicitedAuthnResponse: api.idpAllowUnsolicitedAuthnResponse,