Search in sources :

Example 1 with WebAuthnSettings

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;
}
Also used : RelyingParty(io.vertx.ext.auth.webauthn.RelyingParty) WebAuthnSettings(io.gravitee.am.model.login.WebAuthnSettings)

Example 2 with WebAuthnSettings

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;
}
Also used : WebAuthnSettings(io.gravitee.am.model.login.WebAuthnSettings)

Example 3 with 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());
}
Also used : RelyingParty(io.vertx.ext.auth.webauthn.RelyingParty) WebAuthn(io.vertx.reactivex.ext.auth.webauthn.WebAuthn) WebAuthnSettings(io.gravitee.am.model.login.WebAuthnSettings) Test(org.junit.Test)

Example 4 with WebAuthnSettings

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());
}
Also used : RelyingParty(io.vertx.ext.auth.webauthn.RelyingParty) WebAuthn(io.vertx.reactivex.ext.auth.webauthn.WebAuthn) WebAuthnSettings(io.gravitee.am.model.login.WebAuthnSettings) Test(org.junit.Test)

Example 5 with WebAuthnSettings

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());
}
Also used : RelyingParty(io.vertx.ext.auth.webauthn.RelyingParty) WebAuthn(io.vertx.reactivex.ext.auth.webauthn.WebAuthn) WebAuthnSettings(io.gravitee.am.model.login.WebAuthnSettings) Test(org.junit.Test)

Aggregations

WebAuthnSettings (io.gravitee.am.model.login.WebAuthnSettings)7 RelyingParty (io.vertx.ext.auth.webauthn.RelyingParty)4 WebAuthn (io.vertx.reactivex.ext.auth.webauthn.WebAuthn)3 Test (org.junit.Test)3 Domain (io.gravitee.am.model.Domain)1 SelfServiceAccountManagementSettings (io.gravitee.am.model.SelfServiceAccountManagementSettings)1 VirtualHost (io.gravitee.am.model.VirtualHost)1 AccountSettings (io.gravitee.am.model.account.AccountSettings)1 LoginSettings (io.gravitee.am.model.login.LoginSettings)1 CIBASettingNotifier (io.gravitee.am.model.oidc.CIBASettingNotifier)1 CIBASettings (io.gravitee.am.model.oidc.CIBASettings)1 OIDCSettings (io.gravitee.am.model.oidc.OIDCSettings)1 SCIMSettings (io.gravitee.am.model.scim.SCIMSettings)1 UMASettings (io.gravitee.am.model.uma.UMASettings)1 WebAuthnOptions (io.vertx.ext.auth.webauthn.WebAuthnOptions)1