-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jans-fido): changes to refactor metadataservers #9111
Signed-off-by: shekhar16 <shekharlaad1609@gmail.com>
- Loading branch information
Showing
6 changed files
with
205 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
jans-fido2/model/src/main/java/io/jans/fido2/model/conf/MetadataServer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. | ||
* | ||
* Copyright (c) 2020, Janssen Project | ||
*/ | ||
|
||
package io.jans.fido2.model.conf; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Supported MetadataServer | ||
* | ||
* @author Shekhar L. on 06/08/2024 | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class MetadataServer { | ||
|
||
private String url; | ||
|
||
private List<String> certificateDocumentInum = new ArrayList<String>();; | ||
|
||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public void setUrl(String url) { | ||
this.url = url; | ||
} | ||
|
||
|
||
public List<String> getCertificateDocumentInum() { | ||
return certificateDocumentInum; | ||
} | ||
|
||
public void setCertificateDocumentInum(List<String> certificateDocumentInum) { | ||
this.certificateDocumentInum = certificateDocumentInum; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
jans-fido2/server/src/main/java/io/jans/fido2/service/Fido2Service.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. | ||
* | ||
* Copyright (c) 2020, Janssen Project | ||
*/ | ||
|
||
package io.jans.fido2.service; | ||
|
||
import io.jans.fido2.model.conf.AppConfiguration; | ||
import io.jans.fido2.model.conf.Conf; | ||
import io.jans.fido2.service.app.ConfigurationFactory; | ||
import io.jans.orm.PersistenceEntryManager; | ||
import io.jans.orm.exception.BasePersistenceException; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
import org.slf4j.Logger; | ||
|
||
@ApplicationScoped | ||
public class Fido2Service { | ||
|
||
@Inject | ||
Logger logger; | ||
|
||
@Inject | ||
PersistenceEntryManager persistenceManager; | ||
|
||
@Inject | ||
ConfigurationFactory configurationFactory; | ||
|
||
public Conf findConf() { | ||
try { | ||
String configurationDn = configurationFactory.getBaseConfiguration() | ||
.getString("fido2_ConfigurationEntryDN"); | ||
return persistenceManager.find(Conf.class, configurationDn); | ||
} catch (BasePersistenceException var3) { | ||
logger.error("Failed to load Fido2 configuration from LDAP"); | ||
return null; | ||
} | ||
} | ||
|
||
public AppConfiguration find() { | ||
final Conf conf = findConf(); | ||
return conf.getDynamicConf(); | ||
} | ||
|
||
public void mergeConf(Conf conf) { | ||
conf.setRevision(conf.getRevision() + 1); | ||
persistenceManager.merge(conf); | ||
} | ||
|
||
public void merge(AppConfiguration fido2ConfigJson) { | ||
Conf conf = this.findConf(); | ||
conf.setDynamicConf(fido2ConfigJson); | ||
mergeConf(conf); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.