Skip to content

Commit

Permalink
PB-70375. Add support for IDV authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
eslci committed May 6, 2021
1 parent 586960d commit 7a218bd
Show file tree
Hide file tree
Showing 22 changed files with 1,183 additions and 85 deletions.
78 changes: 51 additions & 27 deletions sdk/src/main/java/com/silanis/esl/api/model/Auth.java
Original file line number Diff line number Diff line change
@@ -1,76 +1,100 @@
package com.silanis.esl.api.model;
//

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.silanis.esl.api.util.SchemaSanitizer;

import java.util.ArrayList;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown=true)

@JsonIgnoreProperties(ignoreUnknown = true)
public class Auth extends Model
implements java.io.Serializable
{

implements java.io.Serializable {

// Dirty Flag Constants
@JsonIgnore
public static final String FIELD_CHALLENGES = "challenges";
@JsonIgnore
public static final String FIELD_SCHEME = "scheme";

@JsonIgnore
public static final String FIELD_IDV_WORKFLOW = "idvWorkflow";

// Empty Constructor
public Auth ( ) {}

public Auth() {
}

// Fields
protected List<AuthChallenge> _challenges = new ArrayList<AuthChallenge>();
protected IdvWorkflow _idvWorkflow;
protected String _scheme = "NONE";

// Accessors


public Auth setChallenges( List<AuthChallenge> value ){
SchemaSanitizer.throwOnNull(FIELD_CHALLENGES,value);

public IdvWorkflow getIdvWorkflow() {
return _idvWorkflow;
}

public Auth setIdvWorkflow(IdvWorkflow value) {
this._idvWorkflow = value;
setDirty(FIELD_IDV_WORKFLOW);
return this;
}

public Auth setChallenges(List<AuthChallenge> value) {
SchemaSanitizer.throwOnNull(FIELD_CHALLENGES, value);
// TODO With proper compare
// if ( this._challenges == value ) return this;
this._challenges = value;
setDirty(FIELD_CHALLENGES);
return this;
}

// Used internally by aws. Invokes a the corresponding setter if the value is not null
@JsonIgnore
public Auth safeSetChallenges( List<AuthChallenge> value ){
if ( value != null ) { this.setChallenges( value ); }
public Auth safeSetChallenges(List<AuthChallenge> value) {
if (value != null) {
this.setChallenges(value);
}
return this;
}
public List<AuthChallenge> getChallenges(){

public List<AuthChallenge> getChallenges() {
return _challenges;
}

// List adder
public Auth addChallenge( AuthChallenge value ){
if (value == null) { throw new IllegalArgumentException("Argument cannot be null"); }
public Auth addChallenge(AuthChallenge value) {
if (value == null) {
throw new IllegalArgumentException("Argument cannot be null");
}
this._challenges.add(value);
setDirty(FIELD_CHALLENGES);
return this;
}



public Auth setScheme( String value ){
SchemaSanitizer.throwOnNull(FIELD_SCHEME,value);


public Auth setScheme(String value) {
SchemaSanitizer.throwOnNull(FIELD_SCHEME, value);
// TODO With proper compare
// if ( this._scheme == value ) return this;
this._scheme = value;
setDirty(FIELD_SCHEME);
return this;
}

// Used internally by aws. Invokes a the corresponding setter if the value is not null
@JsonIgnore
public Auth safeSetScheme( String value ){
if ( value != null ) { this.setScheme( value ); }
public Auth safeSetScheme(String value) {
if (value != null) {
this.setScheme(value);
}
return this;
}
public String getScheme(){

public String getScheme() {
return _scheme;
}


}
82 changes: 82 additions & 0 deletions sdk/src/main/java/com/silanis/esl/api/model/IdvWorkflow.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.silanis.esl.api.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import static com.silanis.esl.api.util.SchemaSanitizer.throwOnNull;

/**
* Created by schoi on 2021-03-10.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class IdvWorkflow extends Model implements java.io.Serializable {

@JsonIgnore
public static final String FIELD_ID = "id";
@JsonIgnore
public static final String FIELD_TYPE = "type";
@JsonIgnore
public static final String FIELD_TENANT = "tenant";
@JsonIgnore
public static final String FIELD_DESC = "desc";

// Empty Constructor
public IdvWorkflow() {
}

// Fields
protected String id;
protected String type;
protected String tenant;
protected String desc;


public IdvWorkflow setId(String value) {
throwOnNull(FIELD_ID, value);

this.id = value;
setDirty(FIELD_ID);
return this;
}

public String getId() {
return id;
}


public IdvWorkflow setType(String value) {
throwOnNull(FIELD_TYPE, value);

this.type = value;
setDirty(FIELD_TYPE);
return this;
}

public String getType() {
return type;
}


public IdvWorkflow setTenant(String value) {
throwOnNull(FIELD_TENANT, value);

this.tenant = value;
setDirty(FIELD_TENANT);
return this;
}

public String getTenant() {
return tenant;
}


public IdvWorkflow setDesc(String value) {
this.desc = value;
setDirty(FIELD_DESC);
return this;
}

public String getDesc() {
return desc;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package com.silanis.esl.api.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import static com.silanis.esl.api.util.SchemaSanitizer.throwOnNull;

/**
* Created by schoi on 2021-05-06.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class IdvWorkflowConfiguration extends Model implements java.io.Serializable {

@JsonIgnore
public static final String FIELD_ID = "id";
@JsonIgnore
public static final String FIELD_TYPE = "type";
@JsonIgnore
public static final String FIELD_TENANT = "tenant";
@JsonIgnore
public static final String FIELD_DESC = "desc";
@JsonIgnore
public static final String FIELD_SKIP_WHEN_ACCESSING_SIGNED_DOCUMENTS = "skipWhenAccessingSignedDocuments";

@JsonProperty("id")
protected String workflowId;
@JsonProperty("type")
protected String type;
@JsonProperty("tenant")
protected String tenant;
@JsonProperty("desc")
protected String desc;
@JsonProperty("skipWhenAccessingSignedDocuments")
protected boolean skipWhenAccessingSignedDocuments;

public IdvWorkflowConfiguration setWorkflowId(String value) {
throwOnNull(FIELD_ID, value);

this.workflowId = value;
setDirty(FIELD_ID);
return this;
}

public String getWorkflowId() {
return workflowId;
}


public IdvWorkflowConfiguration setType(String value) {
throwOnNull(FIELD_TYPE, value);

this.type = value;
setDirty(FIELD_TYPE);
return this;
}

public String getType() {
return type;
}


public IdvWorkflowConfiguration setTenant(String value) {
throwOnNull(FIELD_TENANT, value);

this.tenant = value;
setDirty(FIELD_TENANT);
return this;
}

public String getTenant() {
return tenant;
}


public IdvWorkflowConfiguration setDesc(String value) {
this.desc = value;
setDirty(FIELD_DESC);
return this;
}

public String getDesc() {
return desc;
}


public IdvWorkflowConfiguration setSkipWhenAccessingSignedDocuments(boolean value) {
this.skipWhenAccessingSignedDocuments = value;
setDirty(FIELD_SKIP_WHEN_ACCESSING_SIGNED_DOCUMENTS);
return this;
}

public boolean isSkipWhenAccessingSignedDocuments() {
return skipWhenAccessingSignedDocuments;
}

}
15 changes: 13 additions & 2 deletions sdk/src/main/java/com/silanis/esl/sdk/Authentication.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class Authentication {
private final AuthenticationMethod method;
private List<Challenge> challenges = new ArrayList<Challenge>();
private String phoneNumber;
private IdvWorkflow idvWorkflow;

public Authentication(AuthenticationMethod method) {
this.method = method;
Expand All @@ -18,11 +19,17 @@ public Authentication(List<Challenge> challenges) {
this.challenges.addAll(challenges);
}

public Authentication(String phoneNumber) {
this(AuthenticationMethod.SMS);
public Authentication(AuthenticationMethod method, String phoneNumber) {
this(method);
this.phoneNumber = phoneNumber;
}

public Authentication(AuthenticationMethod method, String phoneNumber, IdvWorkflow idvWorkflow) {
this(method);
this.phoneNumber = phoneNumber;
this.idvWorkflow = idvWorkflow;
}

public AuthenticationMethod getMethod() {
return method;
}
Expand All @@ -34,4 +41,8 @@ public List<Challenge> getChallenges() {
public String getPhoneNumber() {
return phoneNumber;
}

public IdvWorkflow getIdvWorkflow() {
return idvWorkflow;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class AuthenticationMethod extends EslEnumeration {
public static final AuthenticationMethod SMS = new AuthenticationMethod("SMS", "SMS", 2);
public static final AuthenticationMethod KBA = new AuthenticationMethod("KBA", "KBA", 3);
public static final AuthenticationMethod SSO = new AuthenticationMethod("SSO", "SSO", 4);
public static final AuthenticationMethod IDV = new AuthenticationMethod("ID_VERIFICATION", "IDV", 5);

/**
* DO NOT USE! This is an internal implementation concern. It is there to avoid crashes in existing code when new values are added to the enumerations
Expand All @@ -32,6 +33,7 @@ public static final AuthenticationMethod UNRECOGNIZED(String unknownValue){
sdkValues.put(SMS.name(), SMS);
sdkValues.put(KBA.name(), KBA);
sdkValues.put(SSO.name(), SSO);
sdkValues.put(IDV.name(), IDV);
}

private AuthenticationMethod(String apiValue, String sdkValue, int index) {
Expand Down
Loading

0 comments on commit 7a218bd

Please sign in to comment.