Skip to content

Commit

Permalink
Update TypeScript service defaults to match Java (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbearcsiro authored Jul 26, 2022
1 parent 6363a7d commit 0d5d14c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,8 @@ export function usernameProviderFactory(provider?: any, type?: UserAttributeType
if (type === UserAttributeType.ANONYMOUS || (!type && AnonymousRegisteredServiceUsernameProvider.instanceOf(provider))) {
return new AnonymousRegisteredServiceUsernameProvider(provider);
}
if (!type && !provider) {
return new DefaultRegisteredServiceUsernameProvider();
}
return provider;
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class ReturnAllowedAttributeReleasePolicy extends AbstractRegisteredServi
super(policy);
const p: ReturnAllowedAttributeReleasePolicy = ReturnAllowedAttributeReleasePolicy.instanceOf(policy)
? policy as ReturnAllowedAttributeReleasePolicy : undefined;
this.allowedAttributes = p?.allowedAttributes;
this.allowedAttributes = p?.allowedAttributes ?? [];
this['@class'] = ReturnAllowedAttributeReleasePolicy.cName;
}
}
Expand Down Expand Up @@ -488,7 +488,7 @@ export function attributeReleaseFactory(policy?: any, type?: ReleasePolicyType):
return new ChainingAttributeReleasePolicy(policy);
}
if (!type && !policy) {
return new DenyAllAttributeReleasePolicy();
return new ReturnAllowedAttributeReleasePolicy();
}
return policy;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class DefaultRegisteredServiceMultifactorPolicy extends RegisteredService
const p: DefaultRegisteredServiceMultifactorPolicy = DefaultRegisteredServiceMultifactorPolicy.instanceOf(policy)
? policy as DefaultRegisteredServiceMultifactorPolicy : undefined;
this.multifactorAuthenticationProviders = p?.multifactorAuthenticationProviders;
this.failureMode = p?.failureMode;
this.failureMode = p?.failureMode ?? 'UNDEFINED';
this.principalAttributeNameTrigger = p?.principalAttributeNameTrigger;
this.principalAttributeValueToMatch = p?.principalAttributeValueToMatch;
this.bypassEnabled = p?.bypassEnabled ?? false;
Expand Down Expand Up @@ -88,5 +88,8 @@ export function mfaPolicyFactory(policy?: any, type?: MfaPolicyType): Registered
if (type === MfaPolicyType.GROOVY || (!type && GroovyRegisteredServiceMultifactorPolicy.instanceOf(policy))) {
return new GroovyRegisteredServiceMultifactorPolicy(policy);
}
if (!type && !policy) {
return new DefaultRegisteredServiceMultifactorPolicy();
}
return policy;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export class OAuthRegisteredService extends RegexRegisteredService {
this.clientId = s?.clientId;
this.bypassApprovalPrompt = s?.bypassApprovalPrompt ?? false;
this.generateRefreshToken = s?.generateRefreshToken ?? false;
this.supportedGrantTypes = s?.supportedGrantTypes;
this.supportedResponseTypes = s?.supportedResponseTypes;
this.supportedGrantTypes = s?.supportedGrantTypes ?? [];
this.supportedResponseTypes = s?.supportedResponseTypes ?? [];
this.jwtAccessToken = s?.jwtAccessToken ?? false;
this.codeExpirationPolicy = codeExpirationPolicy(s?.codeExpirationPolicy);
this.accessTokenExpirationPolicy = accessTokenExpirationPolicy(s?.accessTokenExpirationPolicy);
Expand Down Expand Up @@ -112,7 +112,7 @@ export class OidcRegisteredService extends OAuthRegisteredService {
this.userInfoEncryptedResponseEncoding = s?.userInfoEncryptedResponseEncoding;
this.dynamicallyRegistered = s?.dynamicallyRegistered ?? false;
this.dynamicRegistrationDateTime = s?.dynamicRegistrationDateTime;
this.scopes = s?.scopes;
this.scopes = s?.scopes ?? [];
this.subjectType = s?.subjectType ?? 'PUBLIC';
this.sectorIdentifierUri = s?.sectorIdentifierUri;
this.applicationType = s?.applicationType ?? 'web';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export abstract class RegisteredService {
this.logoutType = service?.logoutType ?? 'BACK_CHANNEL';
this.accessStrategy = accessStrategyFactory(service?.accessStrategy);
this.publicKey = service?.publicKey;
this.properties = service?.properties;
this.properties = service?.properties ?? new Map<string, DefaultRegisteredServiceProperty>();
this.contacts = contactsFactory(service?.contacts);
this.expirationPolicy = expirationPolicyFactory(service?.expirationPolicy);
this.environments = service?.environments;
Expand Down

0 comments on commit 0d5d14c

Please sign in to comment.