Skip to content

Commit

Permalink
fix(jans-casa): enrollment of a passkey implies the enrollment… (#10473)
Browse files Browse the repository at this point in the history
fix(jans-casa): #10470 Enrollment of a passkey implies the enrollment of all three types of authenticator - client-device, hybrid, security-key

Co-authored-by: Mohammad Abudayyeh <[email protected]>
  • Loading branch information
maduvena and moabu authored Dec 20, 2024
1 parent f99d870 commit b0a7da3
Show file tree
Hide file tree
Showing 10 changed files with 306 additions and 344 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,16 @@ public <T> List<T> find(Class<T> clazz, String baseDn, Filter filter, int start,
}

public <T> List<T> find(Class<T> clazz, String baseDn, Filter filter) {

logger.debug(baseDn);
logger.debug(clazz.toString());
logger.debug(filter.toString());
try {
return entryManager.findEntries(baseDn, clazz, filter);
} catch (Exception e) {
//logger.error(e.getMessage(), e);
//TODO: uncomment the above once https://github.com/GluuFederation/oxCore/issues/160 is solved
logger.error(e.getMessage());
e.printStackTrace();
return Collections.emptyList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,39 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)

public class Fido2RegistrationData {

private static final long serialVersionUID = 4599467930864459334L;

private String username;
private String domain;
private String origin;
private String userId;
private String challenge;

private String attenstationRequest;
private String attenstationResponse;

private String attestationRequest;
private String attestationResponse;
private String uncompressedECPoint;
private String publicKeyId;

private String type;

private String status;
private int counter;

private String attestationType;

private int signatureAlgorithm;

private String applicationId;
private String rpId;
// Credential backup eligibility and current backup state is conveyed by the
// backupStateFlag and backupEligibilityFlag flags in the authenticator data.
// See https://w3c.github.io/webauthn/#sctn-authenticator-data
private boolean backupStateFlag;
private boolean backupEligibilityFlag;
private boolean attestedCredentialDataFlag;
private boolean extensionDataFlag;
private boolean userVerifiedFlag;
private boolean userPresentFlag;

private String authentictatorAttachment;

private String credId;
private String transports[];

public String getUsername() {
return username;
Expand All @@ -35,14 +46,6 @@ public void setUsername(String username) {
this.username = username;
}

public String getDomain() {
return domain;
}

public void setDomain(String domain) {
this.domain = domain;
}

public String getUserId() {
return userId;
}
Expand All @@ -59,20 +62,20 @@ public void setChallenge(String challenge) {
this.challenge = challenge;
}

public String getAttenstationRequest() {
return attenstationRequest;
public String getAttestationRequest() {
return attestationRequest;
}

public void setAttenstationRequest(String attenstationRequest) {
this.attenstationRequest = attenstationRequest;
public void setAttestationRequest(String attestationRequest) {
this.attestationRequest = attestationRequest;
}

public String getAttenstationResponse() {
return attenstationResponse;
public String getAttestationResponse() {
return attestationResponse;
}

public void setAttenstationResponse(String attenstationResponse) {
this.attenstationResponse = attenstationResponse;
public void setAttestationResponse(String attestationResponse) {
this.attestationResponse = attestationResponse;
}

public String getUncompressedECPoint() {
Expand All @@ -99,6 +102,14 @@ public void setType(String type) {
this.type = type;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

public int getCounter() {
return counter;
}
Expand All @@ -123,21 +134,92 @@ public void setSignatureAlgorithm(int signatureAlgorithm) {
this.signatureAlgorithm = signatureAlgorithm;
}

public String getApplicationId() {
return applicationId;
public boolean getBackupStateFlag() {
return this.backupStateFlag;
}

public void setBackupStateFlag(boolean backupStateFlag) {
this.backupStateFlag = backupStateFlag;
}

public boolean getBackupEligibilityFlag() {
return this.backupEligibilityFlag;
}

public void setBackupEligibilityFlag(boolean backupEligibilityFlag) {
this.backupEligibilityFlag = backupEligibilityFlag;
}

public String getOrigin() {
return origin;
}

public void setOrigin(String origin) {
this.origin = origin;
}

public String getRpId() {
return rpId;
}

public void setRpId(String rpId) {
this.rpId = rpId;
}

public boolean isAttestedCredentialDataFlag() {
return attestedCredentialDataFlag;
}

public void setAttestedCredentialDataFlag(boolean attestedCredentialDataFlag) {
this.attestedCredentialDataFlag = attestedCredentialDataFlag;
}

public boolean isExtensionDataFlag() {
return extensionDataFlag;
}

public void setExtensionDataFlag(boolean extensionDataFlag) {
this.extensionDataFlag = extensionDataFlag;
}

public boolean isUserVerifiedFlag() {
return userVerifiedFlag;
}

public void setUserVerifiedFlag(boolean userVerifiedFlag) {
this.userVerifiedFlag = userVerifiedFlag;
}

public boolean isUserPresentFlag() {
return userPresentFlag;
}

public void setUserPresentFlag(boolean userPresentFlag) {
this.userPresentFlag = userPresentFlag;
}

public String getAuthentictatorAttachment() {
return authentictatorAttachment;
}

public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
public void setAuthentictatorAttachment(String authentictatorAttachment) {
this.authentictatorAttachment = authentictatorAttachment;
}

@Override
public String toString() {
return "Fido2RegistrationData [username=" + username + ", domain=" + domain + ", userId=" + userId
+ ", challenge=" + challenge + ", attenstationRequest=" + attenstationRequest
+ ", attenstationResponse=" + attenstationResponse + ", uncompressedECPoint=" + uncompressedECPoint
+ ", publicKeyId=" + publicKeyId + ", type=" + type + ", counter=" + counter
+ ", attestationType=" + attestationType + ", signatureAlgorithm=" + signatureAlgorithm
+ ", applicationId=" + applicationId + "]";
public String getCredId() {
return credId;
}

public void setCredId(String credId) {
this.credId = credId;
}

public String[] getTransports() {
return transports;
}

public void setTransports(String[] transports) {
this.transports = transports;
}

}
Original file line number Diff line number Diff line change
@@ -1,79 +1,77 @@
package io.jans.casa.core.model;

import java.util.Date;

import io.jans.as.model.fido.u2f.protocol.DeviceData;
import io.jans.orm.annotation.AttributeName;
import io.jans.orm.annotation.DataEntry;
import io.jans.orm.annotation.ObjectClass;
import io.jans.orm.annotation.JsonObject;
import io.jans.orm.annotation.ObjectClass;
import io.jans.orm.model.base.Entry;

import java.util.Date;

//Using Fido2RegistrationEntry directly from fido2-model artifact does not work well!
@DataEntry
@ObjectClass(value = "jansFido2RegistrationEntry")
public class Fido2RegistrationEntry extends Entry {

@AttributeName
private String displayName;
@AttributeName
private String displayName;

@AttributeName
private Date creationDate;
@AttributeName
private Date creationDate;

@AttributeName(name = "jansId")
private String id;

@AttributeName(name = "jansApp")
private String application;
@AttributeName(name = "jansId")
private String id;

@JsonObject
@AttributeName(name = "jansRegistrationData" , ignoreDuringUpdate = true)
private Fido2RegistrationData registrationData;

@AttributeName(name = "jansCounter", ignoreDuringUpdate = true)
@AttributeName(name = "jansApp")
private String application;

@JsonObject
@AttributeName(name = "jansRegistrationData", ignoreDuringUpdate = true)
private Fido2RegistrationData registrationData;

@AttributeName(name = "jansCounter", ignoreDuringUpdate = true)
private int counter;

@JsonObject
@AttributeName(name = "jansDeviceData", ignoreDuringUpdate = true)
private DeviceData deviceData;


@JsonObject
@AttributeName(name = "jansStatus" , ignoreDuringUpdate = true)
private String registrationStatus;



public String getDisplayName() {
return displayName;
}

public void setDisplayName(String displayName) {
this.displayName = displayName;
}

public Date getCreationDate() {
return creationDate;
}

public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public Fido2RegistrationData getRegistrationData() {
return registrationData;
}

public void setRegistrationData(Fido2RegistrationData registrationData) {
this.registrationData = registrationData;
}
@JsonObject
@AttributeName(name = "jansDeviceData", ignoreDuringUpdate = true)
private DeviceData deviceData;

@JsonObject
@AttributeName(name = "jansStatus", ignoreDuringUpdate = true)
private String registrationStatus;

public String getDisplayName() {
return displayName;
}

public void setDisplayName(String displayName) {
this.displayName = displayName;
}

public Date getCreationDate() {
return creationDate;
}

public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public Fido2RegistrationData getRegistrationData() {
return registrationData;
}

public void setRegistrationData(Fido2RegistrationData registrationData) {
this.registrationData = registrationData;
}

public int getCounter() {
return counter;
Expand Down Expand Up @@ -107,6 +105,4 @@ public void setApplication(String application) {
this.application = application;
}



}
Loading

0 comments on commit b0a7da3

Please sign in to comment.