Search in sources :

Example 1 with CIBASettings

use of io.gravitee.am.model.oidc.CIBASettings in project gravitee-access-management by gravitee-io.

the class PatchOIDCSettingsTest method testPatchToCIBA.

@Test
public void testPatchToCIBA() {
    // Build patcher
    PatchOIDCSettings patchOIDCSettings = new PatchOIDCSettings();
    PatchCIBASettings patchCiba = new PatchCIBASettings();
    patchCiba.setEnabled(Optional.of(true));
    patchOIDCSettings.setCibaSettings(Optional.of(patchCiba));
    // build settings to patch
    OIDCSettings settings = new OIDCSettings();
    final CIBASettings cibaSettings = new CIBASettings();
    cibaSettings.setEnabled(false);
    settings.setCibaSettings(cibaSettings);
    assertFalse("CIBA settings shall be false before update", settings.getCibaSettings().isEnabled());
    // apply patch on null object
    OIDCSettings result = patchOIDCSettings.patch(settings);
    assertNotNull(result);
    assertNotNull(result.getCibaSettings());
    assertTrue("CIBA settings shall be true after update", result.getCibaSettings().isEnabled());
}
Also used : CIBASettings(io.gravitee.am.model.oidc.CIBASettings) OIDCSettings(io.gravitee.am.model.oidc.OIDCSettings) Test(org.junit.Test)

Example 2 with CIBASettings

use of io.gravitee.am.model.oidc.CIBASettings in project gravitee-access-management by gravitee-io.

the class PatchCIBASettings method patch.

public CIBASettings patch(CIBASettings toPatch) {
    CIBASettings result = toPatch != null ? toPatch : CIBASettings.defaultSettings();
    SetterUtils.safeSet(result::setEnabled, this.getEnabled(), boolean.class);
    SetterUtils.safeSet(result::setAuthReqExpiry, this.getAuthReqExpiry(), int.class);
    SetterUtils.safeSet(result::setTokenReqInterval, this.getTokenReqInterval(), int.class);
    SetterUtils.safeSet(result::setBindingMessageLength, this.getBindingMessageLength(), int.class);
    SetterUtils.safeSet(result::setDeviceNotifiers, this.getDeviceNotifiers(), List.class);
    return result;
}
Also used : CIBASettings(io.gravitee.am.model.oidc.CIBASettings)

Example 3 with CIBASettings

use of io.gravitee.am.model.oidc.CIBASettings in project gravitee-access-management by gravitee-io.

the class PatchOIDCSettings method patch.

public OIDCSettings patch(OIDCSettings toPatch) {
    // If source may be null, in such case init with default values
    if (toPatch == null) {
        toPatch = OIDCSettings.defaultSettings();
    }
    SetterUtils.safeSet(toPatch::setRedirectUriStrictMatching, this.getRedirectUriStrictMatching(), boolean.class);
    SetterUtils.safeSet(toPatch::setPostLogoutRedirectUris, this.getPostLogoutRedirectUris());
    if (getClientRegistrationSettings() != null) {
        // If present apply settings, else return default settings.
        if (getClientRegistrationSettings().isPresent()) {
            PatchClientRegistrationSettings patcher = getClientRegistrationSettings().get();
            ClientRegistrationSettings source = toPatch.getClientRegistrationSettings();
            toPatch.setClientRegistrationSettings(patcher.patch(source));
        } else {
            toPatch.setClientRegistrationSettings(ClientRegistrationSettings.defaultSettings());
        }
    }
    if (getSecurityProfileSettings() != null) {
        if (getSecurityProfileSettings().isPresent()) {
            final PatchSecurityProfileSettings patcher = getSecurityProfileSettings().get();
            final SecurityProfileSettings source = toPatch.getSecurityProfileSettings();
            toPatch.setSecurityProfileSettings(patcher.patch(source));
        } else {
            toPatch.setSecurityProfileSettings(SecurityProfileSettings.defaultSettings());
        }
    }
    if (getCibaSettings() != null) {
        if (getCibaSettings().isPresent()) {
            final PatchCIBASettings patcher = getCibaSettings().get();
            final CIBASettings source = toPatch.getCibaSettings();
            toPatch.setCibaSettings(patcher.patch(source));
        } else {
            toPatch.setCibaSettings(CIBASettings.defaultSettings());
        }
    }
    return toPatch;
}
Also used : ClientRegistrationSettings(io.gravitee.am.model.oidc.ClientRegistrationSettings) CIBASettings(io.gravitee.am.model.oidc.CIBASettings) SecurityProfileSettings(io.gravitee.am.model.oidc.SecurityProfileSettings)

Example 4 with CIBASettings

use of io.gravitee.am.model.oidc.CIBASettings in project gravitee-access-management by gravitee-io.

the class AuthenticationRequestServiceTest method init.

@Before
public void init() {
    final OIDCSettings oidc = new OIDCSettings();
    this.cibaSettings = new CIBASettings();
    oidc.setCibaSettings(this.cibaSettings);
    this.domain.setOidc(oidc);
}
Also used : CIBASettings(io.gravitee.am.model.oidc.CIBASettings) OIDCSettings(io.gravitee.am.model.oidc.OIDCSettings) Before(org.junit.Before)

Example 5 with CIBASettings

use of io.gravitee.am.model.oidc.CIBASettings in project gravitee-access-management by gravitee-io.

the class DomainRepositoryTest method initDomain.

private Domain initDomain(String name) {
    Domain domain = new Domain();
    domain.setName(name);
    domain.setHrid(name);
    domain.setCreatedAt(new Date());
    domain.setUpdatedAt(domain.getCreatedAt());
    domain.setDescription(name + " description");
    domain.setEnabled(true);
    domain.setAlertEnabled(false);
    domain.setPath("/" + name);
    domain.setReferenceId("refId" + name);
    domain.setReferenceType(ReferenceType.ENVIRONMENT);
    domain.setVhostMode(true);
    VirtualHost host = new VirtualHost();
    host.setHost("hostname-" + name);
    host.setPath("/hostname-" + name);
    host.setOverrideEntrypoint(true);
    VirtualHost host2 = new VirtualHost();
    host2.setHost("hostname2-" + name);
    host2.setPath("/hostname2-" + name);
    host2.setOverrideEntrypoint(true);
    domain.setVhosts(Arrays.asList(host, host2));
    domain.setTags(new HashSet<>(Arrays.asList("tag1", "tag2")));
    domain.setIdentities(new HashSet<>(Arrays.asList("id1", "id2")));
    domain.setAccountSettings(new AccountSettings());
    domain.setLoginSettings(new LoginSettings());
    final OIDCSettings oidc = new OIDCSettings();
    final CIBASettings cibaSettings = new CIBASettings();
    cibaSettings.setEnabled(true);
    final CIBASettingNotifier notifier = new CIBASettingNotifier();
    notifier.setId(UUID.randomUUID().toString());
    cibaSettings.setDeviceNotifiers(Arrays.asList(notifier));
    oidc.setCibaSettings(cibaSettings);
    domain.setOidc(oidc);
    domain.setScim(new SCIMSettings());
    domain.setUma(new UMASettings());
    domain.setWebAuthnSettings(new WebAuthnSettings());
    domain.setSelfServiceAccountManagementSettings(new SelfServiceAccountManagementSettings());
    return domain;
}
Also used : SCIMSettings(io.gravitee.am.model.scim.SCIMSettings) CIBASettings(io.gravitee.am.model.oidc.CIBASettings) OIDCSettings(io.gravitee.am.model.oidc.OIDCSettings) WebAuthnSettings(io.gravitee.am.model.login.WebAuthnSettings) UMASettings(io.gravitee.am.model.uma.UMASettings) AccountSettings(io.gravitee.am.model.account.AccountSettings) CIBASettingNotifier(io.gravitee.am.model.oidc.CIBASettingNotifier) SelfServiceAccountManagementSettings(io.gravitee.am.model.SelfServiceAccountManagementSettings) LoginSettings(io.gravitee.am.model.login.LoginSettings) VirtualHost(io.gravitee.am.model.VirtualHost) Domain(io.gravitee.am.model.Domain)

Aggregations

CIBASettings (io.gravitee.am.model.oidc.CIBASettings)5 OIDCSettings (io.gravitee.am.model.oidc.OIDCSettings)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 WebAuthnSettings (io.gravitee.am.model.login.WebAuthnSettings)1 CIBASettingNotifier (io.gravitee.am.model.oidc.CIBASettingNotifier)1 ClientRegistrationSettings (io.gravitee.am.model.oidc.ClientRegistrationSettings)1 SecurityProfileSettings (io.gravitee.am.model.oidc.SecurityProfileSettings)1 SCIMSettings (io.gravitee.am.model.scim.SCIMSettings)1 UMASettings (io.gravitee.am.model.uma.UMASettings)1 Before (org.junit.Before)1 Test (org.junit.Test)1