use of io.gravitee.am.model.login.WebAuthnSettings in project gravitee-access-management by gravitee-io.
the class WebAuthnFactory method getRelyingParty.
public RelyingParty getRelyingParty() {
RelyingParty relyingParty = new RelyingParty();
WebAuthnSettings webAuthnSettings = domain.getWebAuthnSettings();
if (webAuthnSettings == null) {
relyingParty.setName(DEFAULT_RELYING_PARTY_NAME).setId(RequestUtils.getDomain(DEFAULT_ORIGIN));
} else {
relyingParty.setName(webAuthnSettings.getRelyingPartyName() != null ? webAuthnSettings.getRelyingPartyName() : DEFAULT_RELYING_PARTY_NAME).setId(webAuthnSettings.getRelyingPartyId() != null ? webAuthnSettings.getRelyingPartyId() : (webAuthnSettings.getOrigin() != null ? RequestUtils.getDomain(webAuthnSettings.getOrigin()) : RequestUtils.getDomain(DEFAULT_ORIGIN)));
}
return relyingParty;
}
use of io.gravitee.am.model.login.WebAuthnSettings in project gravitee-access-management by gravitee-io.
the class MongoDomainRepository method convert.
private static WebAuthnSettings convert(WebAuthnSettingsMongo webAuthnSettingsMongo) {
if (webAuthnSettingsMongo == null) {
return null;
}
WebAuthnSettings webAuthnSettings = new WebAuthnSettings();
webAuthnSettings.setOrigin(webAuthnSettingsMongo.getOrigin());
webAuthnSettings.setRelyingPartyId(webAuthnSettingsMongo.getRelyingPartyId());
webAuthnSettings.setRelyingPartyName(webAuthnSettingsMongo.getRelyingPartyName());
webAuthnSettings.setRequireResidentKey(webAuthnSettingsMongo.isRequireResidentKey());
webAuthnSettings.setUserVerification(webAuthnSettingsMongo.getUserVerification() != null ? UserVerification.fromString(webAuthnSettingsMongo.getUserVerification()) : null);
webAuthnSettings.setAuthenticatorAttachment(webAuthnSettingsMongo.getAuthenticatorAttachment() != null ? AuthenticatorAttachment.fromString(webAuthnSettingsMongo.getAuthenticatorAttachment()) : null);
webAuthnSettings.setAttestationConveyancePreference(webAuthnSettingsMongo.getAttestationConveyancePreference() != null ? AttestationConveyancePreference.fromString(webAuthnSettingsMongo.getAttestationConveyancePreference()) : null);
webAuthnSettings.setForceRegistration(webAuthnSettingsMongo.isForceRegistration());
webAuthnSettings.setCertificates(webAuthnSettingsMongo.getCertificates());
return webAuthnSettings;
}
use of io.gravitee.am.model.login.WebAuthnSettings in project gravitee-access-management by gravitee-io.
the class WebAuthnFactoryTest method testCustom_partialSettings.
@Test
public void testCustom_partialSettings() {
WebAuthnSettings webAuthnSettings = mock(WebAuthnSettings.class);
when(webAuthnSettings.getRelyingPartyName()).thenReturn("Custom RP name");
when(webAuthnSettings.getOrigin()).thenReturn("https://auth.mycompany.com:8443");
when(domain.getWebAuthnSettings()).thenReturn(webAuthnSettings);
WebAuthn webAuthn = webAuthnFactory.getObject();
RelyingParty relyingParty = webAuthnFactory.getRelyingParty();
Assert.assertNotNull(webAuthn);
Assert.assertNotNull(relyingParty);
Assert.assertEquals("Custom RP name", relyingParty.getName());
Assert.assertEquals("auth.mycompany.com", relyingParty.getId());
}
use of io.gravitee.am.model.login.WebAuthnSettings in project gravitee-access-management by gravitee-io.
the class WebAuthnFactoryTest method testCustom_emptySettings.
@Test
public void testCustom_emptySettings() {
when(domain.getWebAuthnSettings()).thenReturn(new WebAuthnSettings());
WebAuthn webAuthn = webAuthnFactory.getObject();
RelyingParty relyingParty = webAuthnFactory.getRelyingParty();
Assert.assertNotNull(webAuthn);
Assert.assertNotNull(relyingParty);
Assert.assertEquals("Gravitee.io Access Management", relyingParty.getName());
Assert.assertEquals("localhost", relyingParty.getId());
}
use of io.gravitee.am.model.login.WebAuthnSettings in project gravitee-access-management by gravitee-io.
the class WebAuthnFactoryTest method testCustom_fullSettings.
@Test
public void testCustom_fullSettings() {
WebAuthnSettings webAuthnSettings = mock(WebAuthnSettings.class);
when(webAuthnSettings.getRelyingPartyName()).thenReturn("Custom RP name");
when(webAuthnSettings.getRelyingPartyId()).thenReturn("Custom RP ID");
when(domain.getWebAuthnSettings()).thenReturn(webAuthnSettings);
WebAuthn webAuthn = webAuthnFactory.getObject();
RelyingParty relyingParty = webAuthnFactory.getRelyingParty();
Assert.assertNotNull(webAuthn);
Assert.assertNotNull(relyingParty);
Assert.assertEquals("Custom RP name", relyingParty.getName());
Assert.assertEquals("Custom RP ID", relyingParty.getId());
}
Aggregations