Skip to content

Commit

Permalink
Add new authenticator property: authenticationType.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisara-Welmilla committed Oct 2, 2024
1 parent 86e184d commit 2155f5d
Show file tree
Hide file tree
Showing 11 changed files with 362 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.wso2.carbon.identity.application.common.model.ServiceProvider;
import org.wso2.carbon.identity.application.common.model.script.AuthenticationScriptConfig;
import org.wso2.carbon.identity.application.mgt.ApplicationConstants;
import org.wso2.carbon.identity.base.IdentityConstants;

import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -161,13 +160,11 @@ private AuthenticationStep buildAuthenticationStep(AuthenticationStepModel stepM
LocalAuthenticatorConfig localAuthOption = new LocalAuthenticatorConfig();
localAuthOption.setEnabled(true);
localAuthOption.setName(option.getAuthenticator());
localAuthOption.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
localAuthOptions.add(localAuthOption);
} else {
FederatedAuthenticatorConfig federatedAuthConfig = new FederatedAuthenticatorConfig();
federatedAuthConfig.setEnabled(true);
federatedAuthConfig.setName(option.getAuthenticator());
federatedAuthConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);

IdentityProvider federatedIdp = new IdentityProvider();
federatedIdp.setIdentityProviderName(option.getIdp());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,40 @@ public static DefinedByEnum fromValue(String value) {

private DefinedByEnum definedBy;

@XmlType(name="AuthenticationTypeEnum")
@XmlEnum(String.class)
public enum AuthenticationTypeEnum {

@XmlEnumValue("IDENTIFICATION") IDENTIFICATION(String.valueOf("IDENTIFICATION")), @XmlEnumValue("VERIFICATION_ONLY") VERIFICATION_ONLY(String.valueOf("VERIFICATION_ONLY"));


private String value;

AuthenticationTypeEnum(String v) {
value = v;
}

public String value() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

public static AuthenticationTypeEnum fromValue(String value) {
for (AuthenticationTypeEnum b : AuthenticationTypeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

private AuthenticationTypeEnum authenticationType;

@XmlType(name="TypeEnum")
@XmlEnum(String.class)
public enum TypeEnum {
Expand Down Expand Up @@ -200,6 +234,24 @@ public void setDefinedBy(DefinedByEnum definedBy) {
this.definedBy = definedBy;
}

/**
**/
public Authenticator authenticationType(AuthenticationTypeEnum authenticationType) {

this.authenticationType = authenticationType;
return this;
}

@ApiModelProperty(value = "")
@JsonProperty("authenticationType")
@Valid
public AuthenticationTypeEnum getAuthenticationType() {
return authenticationType;
}
public void setAuthenticationType(AuthenticationTypeEnum authenticationType) {
this.authenticationType = authenticationType;
}

/**
**/
public Authenticator type(TypeEnum type) {
Expand Down Expand Up @@ -315,6 +367,7 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.displayName, authenticator.displayName) &&
Objects.equals(this.isEnabled, authenticator.isEnabled) &&
Objects.equals(this.definedBy, authenticator.definedBy) &&
Objects.equals(this.authenticationType, authenticator.authenticationType) &&
Objects.equals(this.type, authenticator.type) &&
Objects.equals(this.image, authenticator.image) &&
Objects.equals(this.description, authenticator.description) &&
Expand All @@ -324,7 +377,7 @@ public boolean equals(java.lang.Object o) {

@Override
public int hashCode() {
return Objects.hash(id, name, displayName, isEnabled, definedBy, type, image, description, tags, self);
return Objects.hash(id, name, displayName, isEnabled, definedBy, authenticationType, type, image, description, tags, self);
}

@Override
Expand All @@ -338,6 +391,7 @@ public String toString() {
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n");
sb.append(" definedBy: ").append(toIndentedString(definedBy)).append("\n");
sb.append(" authenticationType: ").append(toIndentedString(authenticationType)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" image: ").append(toIndentedString(image)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ components:
enum:
- SYSTEM
- USER
authenticationType:
type: string
enum:
- IDENTIFICATION
- VERIFICATION_ONLY
type:
type: string
enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,40 @@ public static DefinedByEnum fromValue(String value) {

private DefinedByEnum definedBy;

@XmlType(name="AuthenticationTypeEnum")
@XmlEnum(String.class)
public enum AuthenticationTypeEnum {

@XmlEnumValue("IDENTIFICATION") IDENTIFICATION(String.valueOf("IDENTIFICATION")), @XmlEnumValue("VERIFICATION_ONLY") VERIFICATION_ONLY(String.valueOf("VERIFICATION_ONLY"));


private String value;

AuthenticationTypeEnum(String v) {
value = v;
}

public String value() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

public static AuthenticationTypeEnum fromValue(String value) {
for (AuthenticationTypeEnum b : AuthenticationTypeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

private AuthenticationTypeEnum authenticationType;

@XmlType(name="TypeEnum")
@XmlEnum(String.class)
public enum TypeEnum {
Expand Down Expand Up @@ -204,6 +238,24 @@ public void setDefinedBy(DefinedByEnum definedBy) {
this.definedBy = definedBy;
}

/**
**/
public Authenticator authenticationType(AuthenticationTypeEnum authenticationType) {

this.authenticationType = authenticationType;
return this;
}

@ApiModelProperty(value = "")
@JsonProperty("authenticationType")
@Valid
public AuthenticationTypeEnum getAuthenticationType() {
return authenticationType;
}
public void setAuthenticationType(AuthenticationTypeEnum authenticationType) {
this.authenticationType = authenticationType;
}

/**
**/
public Authenticator type(TypeEnum type) {
Expand Down Expand Up @@ -291,14 +343,15 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.displayName, authenticator.displayName) &&
Objects.equals(this.isEnabled, authenticator.isEnabled) &&
Objects.equals(this.definedBy, authenticator.definedBy) &&
Objects.equals(this.authenticationType, authenticator.authenticationType) &&
Objects.equals(this.type, authenticator.type) &&
Objects.equals(this.tags, authenticator.tags) &&
Objects.equals(this.properties, authenticator.properties);
}

@Override
public int hashCode() {
return Objects.hash(id, name, displayName, isEnabled, definedBy, type, tags, properties);
return Objects.hash(id, name, displayName, isEnabled, definedBy, authenticationType, type, tags, properties);
}

@Override
Expand All @@ -312,6 +365,7 @@ public String toString() {
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n");
sb.append(" definedBy: ").append(toIndentedString(definedBy)).append("\n");
sb.append(" authenticationType: ").append(toIndentedString(authenticationType)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" properties: ").append(toIndentedString(properties)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,11 @@ components:
enum:
- SYSTEM
- USER
authenticationType:
type: string
enum:
- IDENTIFICATION
- VERIFICATION_ONLY
type:
type: string
enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,40 @@ public static DefinedByEnum fromValue(String value) {
}

private DefinedByEnum definedBy;

@XmlType(name="AuthenticationTypeEnum")
@XmlEnum(String.class)
public enum AuthenticationTypeEnum {

@XmlEnumValue("IDENTIFICATION") IDENTIFICATION(String.valueOf("IDENTIFICATION")), @XmlEnumValue("VERIFICATION_ONLY") VERIFICATION_ONLY(String.valueOf("VERIFICATION_ONLY"));


private String value;

AuthenticationTypeEnum(String v) {
value = v;
}

public String value() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

public static AuthenticationTypeEnum fromValue(String value) {
for (AuthenticationTypeEnum b : AuthenticationTypeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

private AuthenticationTypeEnum authenticationType;
private Boolean isDefault = false;
private List<String> tags = null;

Expand Down Expand Up @@ -150,6 +184,24 @@ public void setDefinedBy(DefinedByEnum definedBy) {
this.definedBy = definedBy;
}

/**
**/
public FederatedAuthenticator authenticationType(AuthenticationTypeEnum authenticationType) {

this.authenticationType = authenticationType;
return this;
}

@ApiModelProperty(value = "")
@JsonProperty("authenticationType")
@Valid
public AuthenticationTypeEnum getAuthenticationType() {
return authenticationType;
}
public void setAuthenticationType(AuthenticationTypeEnum authenticationType) {
this.authenticationType = authenticationType;
}

/**
**/
public FederatedAuthenticator isDefault(Boolean isDefault) {
Expand Down Expand Up @@ -236,14 +288,15 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.name, federatedAuthenticator.name) &&
Objects.equals(this.isEnabled, federatedAuthenticator.isEnabled) &&
Objects.equals(this.definedBy, federatedAuthenticator.definedBy) &&
Objects.equals(this.authenticationType, federatedAuthenticator.authenticationType) &&
Objects.equals(this.isDefault, federatedAuthenticator.isDefault) &&
Objects.equals(this.tags, federatedAuthenticator.tags) &&
Objects.equals(this.properties, federatedAuthenticator.properties);
}

@Override
public int hashCode() {
return Objects.hash(authenticatorId, name, isEnabled, definedBy, isDefault, tags, properties);
return Objects.hash(authenticatorId, name, isEnabled, definedBy, authenticationType, isDefault, tags, properties);
}

@Override
Expand All @@ -256,6 +309,7 @@ public String toString() {
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n");
sb.append(" definedBy: ").append(toIndentedString(definedBy)).append("\n");
sb.append(" authenticationType: ").append(toIndentedString(authenticationType)).append("\n");
sb.append(" isDefault: ").append(toIndentedString(isDefault)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" properties: ").append(toIndentedString(properties)).append("\n");
Expand Down
Loading

0 comments on commit 2155f5d

Please sign in to comment.