Skip to content

Commit

Permalink
fix(fido2): update attribute names in search filters
Browse files Browse the repository at this point in the history
Signed-off-by: Yuriy Movchan <[email protected]>
  • Loading branch information
yurem committed Jul 2, 2024
1 parent 6f49fa5 commit c301fbb
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private void reloadConfiguration() {
}

private boolean isRevisionIncreased() {
final Conf conf = loadConfigurationFromLdap("jansRevision");
final Conf conf = loadConfigurationFromLdap("oxRevision");
if (conf == null) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ public void prepareBranch(final String userInum) {
public List<Fido2AuthenticationEntry> findByChallenge(String challenge, boolean oneStep) {
String baseDn = oneStep ? getDnForAuthenticationEntry(null, null) : getBaseDnForFido2AuthenticationEntries(null);

Filter codeChallengFilter = Filter.createEqualityFilter("jansCodeChallenge", challenge);
Filter codeChallengHashCodeFilter = Filter.createEqualityFilter("jansCodeChallengeHash", challengeGenerator.getChallengeHashCode(challenge));
Filter codeChallengFilter = Filter.createEqualityFilter("oxCodeChallenge", challenge);
Filter codeChallengHashCodeFilter = Filter.createEqualityFilter("oxCodeChallengeHash", challengeGenerator.getChallengeHashCode(challenge));
Filter filter = Filter.createANDFilter(codeChallengFilter, codeChallengHashCodeFilter);

List<Fido2AuthenticationEntry> fido2AuthenticationEntries = persistenceEntryManager.findEntries(baseDn, Fido2AuthenticationEntry.class, filter);
Expand All @@ -167,11 +167,11 @@ public String getDnForAuthenticationEntry(String userInum, String jsId) {
if (StringHelper.isEmpty(jsId)) {
return baseDn;
}
return String.format("jansId=%s,%s", jsId, baseDn);
return String.format("oxId=%s,%s", jsId, baseDn);
}

public String getBaseDnForFido2AuthenticationEntries(String userInum) {
final String userBaseDn = getDnForUser(userInum); // "ou=fido2_auth,inum=1234,ou=people,o=jans"
final String userBaseDn = getDnForUser(userInum); // "ou=fido2_auth,inum=1234,ou=people,o=gluu"
if (StringHelper.isEmpty(userInum)) {
return userBaseDn;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public Optional<Fido2RegistrationEntry> findByPublicKeyId(String userName, Strin
}

Filter filter;
Filter publicKeyIdFilter = Filter.createEqualityFilter("jansPublicKeyId", publicKeyId);
Filter publicKeyIdHashFilter = Filter.createEqualityFilter("jansPublicKeyIdHash", getPublicKeyIdHash(publicKeyId));
Filter publicKeyIdFilter = Filter.createEqualityFilter("oxPublicKeyId", publicKeyId);
Filter publicKeyIdHashFilter = Filter.createEqualityFilter("oxPublicKeyIdHash", getPublicKeyIdHash(publicKeyId));
if (StringHelper.isNotEmpty(rpId)) {
Filter appIdFilter = Filter.createEqualityFilter("jansApp", rpId);
Filter appIdFilter = Filter.createEqualityFilter("oxApplication", rpId);
filter = Filter.createANDFilter(publicKeyIdFilter, publicKeyIdHashFilter, appIdFilter);
} else {
filter = Filter.createANDFilter(publicKeyIdFilter, publicKeyIdHashFilter);
Expand Down Expand Up @@ -165,7 +165,7 @@ public List<Fido2RegistrationEntry> findAllRegisteredByUsername(String username)
}

Filter userInumFilter = Filter.createEqualityFilter("personInum", userInum);
Filter registeredFilter = Filter.createEqualityFilter("jansStatus", Fido2RegistrationStatus.registered.getValue());
Filter registeredFilter = Filter.createEqualityFilter("oxStatus", Fido2RegistrationStatus.registered.getValue());
Filter filter = Filter.createANDFilter(userInumFilter, registeredFilter);

List<Fido2RegistrationEntry> fido2RegistrationnEntries = persistenceEntryManager.findEntries(baseDn, Fido2RegistrationEntry.class, filter);
Expand All @@ -176,8 +176,8 @@ public List<Fido2RegistrationEntry> findAllRegisteredByUsername(String username)
public List<Fido2RegistrationEntry> findByChallenge(String challenge, boolean oneStep) {
String baseDn = oneStep ? getDnForRegistrationEntry(null, null) : getBaseDnForFido2RegistrationEntries(null);

Filter codeChallengFilter = Filter.createEqualityFilter("jansCodeChallenge", challenge);
Filter codeChallengHashCodeFilter = Filter.createEqualityFilter("jansCodeChallengeHash", getChallengeHashCode(challenge));
Filter codeChallengFilter = Filter.createEqualityFilter("oxCodeChallenge", challenge);
Filter codeChallengHashCodeFilter = Filter.createEqualityFilter("oxCodeChallengeHash", getChallengeHashCode(challenge));
Filter filter = Filter.createANDFilter(codeChallengFilter, codeChallengHashCodeFilter);

List<Fido2RegistrationEntry> fido2RegistrationnEntries = persistenceEntryManager.findEntries(baseDn, Fido2RegistrationEntry.class, filter);
Expand Down Expand Up @@ -226,7 +226,7 @@ public String getDnForRegistrationEntry(String userInum, String jsId) {
if (StringHelper.isEmpty(jsId)) {
return baseDn;
}
return String.format("jansId=%s,%s", jsId, baseDn);
return String.format("oxId=%s,%s", jsId, baseDn);
}

public String getUserInum(String userName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private SessionId getSessionId(String sessionId) {
}

private String buildDn(String sessionId) {
return String.format("jansId=%s,%s", sessionId, staticConfiguration.getBaseDn().getSessions());
return String.format("oxId=%s,%s", sessionId, staticConfiguration.getBaseDn().getSessions());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public List<DeviceRegistration> findAllRegisteredByUsername(String username, Str
}
}

Filter resultFilter = Filter.createEqualityFilter("jansStatus", DeviceRegistrationStatus.ACTIVE.getValue());
Filter resultFilter = Filter.createEqualityFilter("oxStatus", DeviceRegistrationStatus.ACTIVE.getValue());

List<DeviceRegistration> fidoRegistrations = persistenceEntryManager.findEntries(baseDn, DeviceRegistration.class, resultFilter,
returnAttributes);
Expand Down Expand Up @@ -186,7 +186,7 @@ public String getDnForU2fDevice(String userInum, String jsId) {
if (StringHelper.isEmpty(jsId)) {
return baseDnForU2fDevices;
}
return String.format("jansId=%s,%s", jsId, baseDnForU2fDevices);
return String.format("oxId=%s,%s", jsId, baseDnForU2fDevices);
}

public String getBaseDnForU2fUserDevices(String userInum) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text.
*
* Copyright (c) 2023, Janssen Project
*/

package org.gluu.fido2.service;

import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void fetchMdsV3Endpoints_withEmptyEndpoint_mdsClientException() throws JsonProce
void fetchMetadataBlob_withValidMdsUrl_valid() throws ParseException {
MdsGetEndpointResponse responseGetEndpoint = ResteasyClientBuilder.newBuilder().build()
.target("https://mds3.fido.tools/getEndpoints").request()
.post(Entity.entity(Collections.singletonMap("endpoint", "https://jans.fido.org"), MediaType.APPLICATION_JSON_TYPE))
.post(Entity.entity(Collections.singletonMap("endpoint", "https://gluu.fido.org"), MediaType.APPLICATION_JSON_TYPE))
.readEntity(MdsGetEndpointResponse.class);
assertNotNull(responseGetEndpoint);
assertFalse(responseGetEndpoint.getResult().isEmpty());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text.
*
* Copyright (c) 2023, Janssen Project
*/

package org.gluu.fido2.service.sg;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text.
*
* Copyright (c) 2023, Janssen Project
*/

package org.gluu.fido2.service.sg;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void getConfiguration_ifEnableAssertionOptionsGenerateEndpointIsTrue_success() t
when(appConfiguration.getFido2Configuration()).thenReturn(fido2Configuration);
when(fido2Configuration.isAssertionOptionsGenerateEndpointEnabled()).thenReturn(true);
when(dataMapperService.createObjectNode()).thenReturn(mapper.createObjectNode(), mapper.createObjectNode(), mapper.createObjectNode());
String issuer = "https://jans-test.org";
String issuer = "https://gluu-test.org";
String baseEndpoint = issuer + "/fido";
when(appConfiguration.getIssuer()).thenReturn(issuer);
when(appConfiguration.getBaseEndpoint()).thenReturn(baseEndpoint);
Expand All @@ -93,7 +93,7 @@ void getConfiguration_ifSuperGluuEnabledIsTrue_success() throws JsonProcessingEx
when(fido2Configuration.isAssertionOptionsGenerateEndpointEnabled()).thenReturn(true);
when(appConfiguration.isSuperGluuEnabled()).thenReturn(true);
when(dataMapperService.createObjectNode()).thenReturn(mapper.createObjectNode(), mapper.createObjectNode(), mapper.createObjectNode());
String issuer = "https://jans-test.org";
String issuer = "https://gluu-test.org";
String baseEndpoint = issuer + "/fido";
when(appConfiguration.getIssuer()).thenReturn(issuer);
when(appConfiguration.getBaseEndpoint()).thenReturn(baseEndpoint);
Expand All @@ -119,7 +119,7 @@ void getConfiguration_happyPath_success() throws JsonProcessingException {
when(fido2Configuration.isAssertionOptionsGenerateEndpointEnabled()).thenReturn(false);
when(appConfiguration.isSuperGluuEnabled()).thenReturn(false);
when(dataMapperService.createObjectNode()).thenReturn(mapper.createObjectNode(), mapper.createObjectNode(), mapper.createObjectNode());
String issuer = "https://jans-test.org";
String issuer = "https://gluu-test.org";
String baseEndpoint = issuer + "/fido";
when(appConfiguration.getIssuer()).thenReturn(issuer);
when(appConfiguration.getBaseEndpoint()).thenReturn(baseEndpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text.
*
* Copyright (c) 2023, Janssen Project
*/

package org.gluu.junit.extension;

import java.io.FileInputStream;
Expand Down
6 changes: 0 additions & 6 deletions server/src/test/java/org/gluu/junit/extension/Name.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text.
*
* Copyright (c) 2023, Janssen Project
*/

package org.gluu.junit.extension;

import java.lang.annotation.ElementType;
Expand Down

0 comments on commit c301fbb

Please sign in to comment.