1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-06 00:03:29 +00: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
5 changed files with 3 additions and 38 deletions

View File

@@ -1,25 +1,8 @@
import { AbstractControl, ValidationErrors, ValidatorFn, Validators } from "@angular/forms"; import { AbstractControl, ValidationErrors, Validators } from "@angular/forms";
import { requiredIf } from "./requiredIf.validator";
/** /**
* A higher order function that takes a ValidatorFn and returns a new validator. * Runs Validators.required on a field only if it's dirty. This prevents error messages from being displayed
* The new validator only runs the ValidatorFn if the control is dirty. This prevents error messages from being * to the user prematurely.
* 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.
*/ */
export function dirtyRequired(control: AbstractControl): ValidationErrors | null { export function dirtyRequired(control: AbstractControl): ValidationErrors | null {
return control.dirty ? Validators.required(control) : 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 { export enum Saml2BindingType {
HttpRedirect = 1, HttpRedirect = 1,
HttpPost = 2, HttpPost = 2,
Artifact = 4,
} }
export enum Saml2NameIdFormat { export enum Saml2NameIdFormat {

View File

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

View File

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