Search in sources :

Example 1 with VirtualHost

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

the class VirtualHostValidatorTest method validate_invalidEmptyHost.

@Test
public void validate_invalidEmptyHost() {
    VirtualHost vhost = getValidVirtualHost();
    vhost.setHost("");
    Throwable throwable = virtualHostValidator.validate(vhost, emptyList()).blockingGet();
    assertNotNull(throwable);
    assertTrue(throwable instanceof InvalidVirtualHostException);
}
Also used : InvalidVirtualHostException(io.gravitee.am.service.exception.InvalidVirtualHostException) VirtualHost(io.gravitee.am.model.VirtualHost) Test(org.junit.Test)

Example 2 with VirtualHost

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

the class VirtualHostValidatorTest method validate_notStartingSlashPath.

@Test
public void validate_notStartingSlashPath() {
    VirtualHost vhost = getValidVirtualHost();
    vhost.setPath("test");
    Throwable throwable = virtualHostValidator.validate(vhost, emptyList()).blockingGet();
    // '/' should be automatically append.
    assertNull(throwable);
}
Also used : VirtualHost(io.gravitee.am.model.VirtualHost) Test(org.junit.Test)

Example 3 with VirtualHost

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

the class VirtualHostValidatorTest method validate_invalidEmptyHostPort.

@Test
public void validate_invalidEmptyHostPort() {
    VirtualHost vhost = getValidVirtualHost();
    vhost.setHost("locahost:");
    Throwable throwable = virtualHostValidator.validate(vhost, emptyList()).blockingGet();
    assertNotNull(throwable);
    assertTrue(throwable instanceof InvalidVirtualHostException);
}
Also used : InvalidVirtualHostException(io.gravitee.am.service.exception.InvalidVirtualHostException) VirtualHost(io.gravitee.am.model.VirtualHost) Test(org.junit.Test)

Example 4 with VirtualHost

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

the class VirtualHostValidatorTest method validate_hostSubDomainOfOneOfDomainConstraints.

@Test
public void validate_hostSubDomainOfOneOfDomainConstraints() {
    VirtualHost vhost = getValidVirtualHost();
    String domainConstraint = vhost.getHost();
    vhost.setHost("level2.level1." + domainConstraint);
    Throwable throwable = virtualHostValidator.validate(vhost, Arrays.asList("test.gravitee.io", "other.gravitee.io", domainConstraint)).blockingGet();
    assertNull(throwable);
}
Also used : VirtualHost(io.gravitee.am.model.VirtualHost) Test(org.junit.Test)

Example 5 with VirtualHost

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

the class VirtualHostValidatorTest method getValidDomain.

private Domain getValidDomain() {
    Domain domain = new Domain();
    domain.setName("Domain Test");
    domain.setPath("/test");
    domain.setVhostMode(false);
    ArrayList<VirtualHost> vhosts = new ArrayList<>();
    VirtualHost vhost = new VirtualHost();
    vhost.setHost("valid.host.gravitee.io");
    vhost.setPath("/test");
    vhosts.add(vhost);
    domain.setVhosts(vhosts);
    return domain;
}
Also used : ArrayList(java.util.ArrayList) VirtualHost(io.gravitee.am.model.VirtualHost) Domain(io.gravitee.am.model.Domain)

Aggregations

VirtualHost (io.gravitee.am.model.VirtualHost)24 Test (org.junit.Test)19 InvalidVirtualHostException (io.gravitee.am.service.exception.InvalidVirtualHostException)9 Domain (io.gravitee.am.model.Domain)7 ArrayList (java.util.ArrayList)5 InternetDomainName (com.google.common.net.InternetDomainName)1 PathUtils (io.gravitee.am.common.utils.PathUtils)1 SelfServiceAccountManagementSettings (io.gravitee.am.model.SelfServiceAccountManagementSettings)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 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 InvalidDomainException (io.gravitee.am.service.exception.InvalidDomainException)1 PathValidator (io.gravitee.am.service.validators.path.PathValidator)1 Completable (io.reactivex.Completable)1 List (java.util.List)1