use of org.keycloak.testsuite.util.ClientBuilder in project keycloak by keycloak.
the class SamlSignatureTest method addAdapterTestRealms.
@Override
public void addAdapterTestRealms(List<RealmRepresentation> testRealms) {
final ClientBuilder salesPostClient = signingSamlClient(APP_CLIENT_ID).baseUrl("http://localhost:8080/sales-post-assertion-and-response-sig").redirectUris("http://localhost:8080/sales-post-assertion-and-response-sig/*");
final String brokerBaseUrl = getAuthServerRoot() + "realms/" + BROKER;
final ClientBuilder brokerRealmIdPClient = signingSamlClient(brokerBaseUrl).baseUrl(brokerBaseUrl + "/broker/" + REALM_NAME + "/endpoint").redirectUris(brokerBaseUrl + "/broker/" + REALM_NAME + "/endpoint");
testRealms.add(RealmBuilder.create().name(REALM_NAME).publicKey(REALM_PUBLIC_KEY).privateKey(REALM_PRIVATE_KEY).client(salesPostClient).client(brokerRealmIdPClient).roles(RolesBuilder.create().realmRole(REQUIRED_ROLE)).build());
testRealms.add(RealmBuilder.create().name(BROKER).publicKey(REALM_PUBLIC_KEY).privateKey(REALM_PRIVATE_KEY).client(salesPostClient).identityProvider(IdentityProviderBuilder.create().alias(REALM_NAME).providerId(SAMLIdentityProviderFactory.PROVIDER_ID).setAttribute(SAMLIdentityProviderConfig.SINGLE_SIGN_ON_SERVICE_URL, getAuthServerRoot() + "realms/" + REALM_NAME + "/protocol/saml").setAttribute(SAMLIdentityProviderConfig.POST_BINDING_AUTHN_REQUEST, "true").setAttribute(SAMLIdentityProviderConfig.POST_BINDING_RESPONSE, "true").setAttribute(SAMLIdentityProviderConfig.SIGNING_CERTIFICATE_KEY, REALM_SIGNING_CERTIFICATE).setAttribute(SAMLIdentityProviderConfig.WANT_ASSERTIONS_SIGNED, "true").setAttribute(SAMLIdentityProviderConfig.VALIDATE_SIGNATURE, "true")).roles(RolesBuilder.create().realmRole(REQUIRED_ROLE)).build());
}
use of org.keycloak.testsuite.util.ClientBuilder in project keycloak by keycloak.
the class CompositeRoleTest method addTestRealms.
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {
RealmBuilder realmBuilder = RealmBuilder.create().name("test").publicKey("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB").privateKey("MIICXAIBAAKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQABAoGAfmO8gVhyBxdqlxmIuglbz8bcjQbhXJLR2EoS8ngTXmN1bo2L90M0mUKSdc7qF10LgETBzqL8jYlQIbt+e6TH8fcEpKCjUlyq0Mf/vVbfZSNaVycY13nTzo27iPyWQHK5NLuJzn1xvxxrUeXI6A2WFpGEBLbHjwpx5WQG9A+2scECQQDvdn9NE75HPTVPxBqsEd2z10TKkl9CZxu10Qby3iQQmWLEJ9LNmy3acvKrE3gMiYNWb6xHPKiIqOR1as7L24aTAkEAtyvQOlCvr5kAjVqrEKXalj0Tzewjweuxc0pskvArTI2Oo070h65GpoIKLc9jf+UA69cRtquwP93aZKtW06U8dQJAF2Y44ks/mK5+eyDqik3koCI08qaC8HYq2wVl7G2QkJ6sbAaILtcvD92ToOvyGyeE0flvmDZxMYlvaZnaQ0lcSQJBAKZU6umJi3/xeEbkJqMfeLclD27XGEFoPeNrmdx0q10Azp4NfJAY+Z8KRyQCR2BEG+oNitBOZ+YXF9KCpH3cdmECQHEigJhYg+ykOvr1aiZUMFT72HU0jnmQe2FVekuG+LJUt2Tm7GtMjTFoGpf0JwrVuZN39fOYAlo+nTixgeW7X8Y=").ssoSessionIdleTimeout(3000).accessTokenLifespan(10000).ssoSessionMaxLifespan(10000).accessCodeLifespanUserAction(1000).accessCodeLifespan(1000).sslRequired(SslRequired.EXTERNAL.toString());
RoleRepresentation realmRole1 = RoleBuilder.create().name("REALM_ROLE_1").build();
RoleRepresentation realmComposite1 = RoleBuilder.create().name("REALM_COMPOSITE_1").composite().realmComposite(realmRole1).build();
RolesBuilder roles = RolesBuilder.create().realmRole(realmRole1).realmRole(RoleBuilder.create().name("REALM_ROLE_2").build()).realmRole(RoleBuilder.create().name("REALM_ROLE_3").build()).realmRole(realmComposite1);
realmBuilder.roles(roles);
UserBuilder realmCompositeUser = UserBuilder.create().username("REALM_COMPOSITE_1_USER").enabled(true).password("password").addRoles(realmComposite1.getName());
realmBuilder.user(realmCompositeUser);
UserBuilder realmRole1User = UserBuilder.create().username("REALM_ROLE_1_USER").enabled(true).password("password").addRoles(realmRole1.getName());
realmBuilder.user(realmRole1User);
ClientBuilder realmComposite1Application = ClientBuilder.create().clientId("REALM_COMPOSITE_1_APPLICATION").name("REALM_COMPOSITE_1_APPLICATION").fullScopeEnabled(Boolean.FALSE).redirectUris("http://localhost:8180/auth/realms/master/app/*", "https://localhost:8543/auth/realms/master/app/*").baseUrl("http://localhost:8180/auth/realms/master/app/auth").adminUrl("http://localhost:8180/auth/realms/master/app/logout").secret("password");
realmBuilder.client(realmComposite1Application);
ClientBuilder realmRole1Application = ClientBuilder.create().clientId("REALM_ROLE_1_APPLICATION").name("REALM_ROLE_1_APPLICATION").fullScopeEnabled(Boolean.FALSE).redirectUris("http://localhost:8180/auth/realms/master/app/*", "https://localhost:8543/auth/realms/master/app/*").baseUrl("http://localhost:8180/auth/realms/master/app/auth").adminUrl("http://localhost:8180/auth/realms/master/app/logout").secret("password");
realmBuilder.client(realmRole1Application);
ClientBuilder appRoleApplication = ClientBuilder.create().clientId("APP_ROLE_APPLICATION").name("APP_ROLE_APPLICATION").fullScopeEnabled(Boolean.FALSE).redirectUris("http://localhost:8180/auth/realms/master/app/*", "https://localhost:8543/auth/realms/master/app/*").baseUrl("http://localhost:8180/auth/realms/master/app/auth").adminUrl("http://localhost:8180/auth/realms/master/app/logout").defaultRoles("APP_ROLE_1", "APP_ROLE_2").secret("password");
realmBuilder.client(appRoleApplication);
UserBuilder realmAppCompositeUser = UserBuilder.create().username("REALM_APP_COMPOSITE_USER").password("password");
realmBuilder.user(realmAppCompositeUser);
UserBuilder realmAppRoleUser = UserBuilder.create().username("REALM_APP_ROLE_USER").password("password").addRoles("APP_ROLE_2");
realmBuilder.user(realmAppRoleUser);
ClientBuilder appCompositeApplication = ClientBuilder.create().clientId("APP_COMPOSITE_APPLICATION").name("APP_COMPOSITE_APPLICATION").fullScopeEnabled(Boolean.FALSE).defaultRoles("APP_COMPOSITE_ROLE").redirectUris("http://localhost:8180/auth/realms/master/app/*", "https://localhost:8543/auth/realms/master/app/*").baseUrl("http://localhost:8180/auth/realms/master/app/auth").adminUrl("http://localhost:8180/auth/realms/master/app/logout").secret("password");
realmBuilder.client(appCompositeApplication);
UserBuilder appCompositeUser = UserBuilder.create().username("APP_COMPOSITE_USER").password("password").addRoles("REALM_COMPOSITE_1");
realmBuilder.user(appCompositeUser);
testRealms.add(realmBuilder.build());
}
use of org.keycloak.testsuite.util.ClientBuilder in project keycloak by keycloak.
the class OAuthRedirectUriTest method addTestRealms.
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {
RealmRepresentation realmRepresentation = loadJson(getClass().getResourceAsStream("/testrealm.json"), RealmRepresentation.class);
RealmBuilder realm = RealmBuilder.edit(realmRepresentation).testEventListener();
ClientBuilder installedApp = ClientBuilder.create().clientId("test-installed").name("test-installed").redirectUris(Constants.INSTALLED_APP_URN, Constants.INSTALLED_APP_URL).secret("password");
realm.client(installedApp);
ClientBuilder installedApp2 = ClientBuilder.create().clientId("test-installed2").name("test-installed2").redirectUris(Constants.INSTALLED_APP_URL + "/myapp").secret("password");
realm.client(installedApp2);
ClientBuilder installedApp3 = ClientBuilder.create().clientId("test-wildcard").name("test-wildcard").redirectUris("http://example.com/foo/*", "http://with-dash.example.local/foo/*", "http://localhost:8280/foo/*").secret("password");
realm.client(installedApp3);
ClientBuilder installedApp4 = ClientBuilder.create().clientId("test-dash").name("test-dash").redirectUris("http://with-dash.example.local", "http://with-dash.example.local/foo").secret("password");
realm.client(installedApp4);
ClientBuilder installedApp5 = ClientBuilder.create().clientId("test-root-url").name("test-root-url").rootUrl("http://with-dash.example.local").redirectUris("/foo").secret("password");
realm.client(installedApp5);
ClientBuilder installedApp6 = ClientBuilder.create().clientId("test-relative-url").name("test-relative-url").rootUrl("").redirectUris("/auth").secret("password");
realm.client(installedApp6);
ClientBuilder installedApp7 = ClientBuilder.create().clientId("test-query-component").name("test-query-component").redirectUris("http://localhost?foo=bar", "http://localhost?foo=bar*").secret("password");
realm.client(installedApp7);
ClientBuilder installedApp8 = ClientBuilder.create().clientId("test-fragment").name("test-fragment").redirectUris("http://localhost:8180/*", "https://localhost:8543/*").secret("password");
realm.client(installedApp8);
ClientBuilder installedAppCustomScheme = ClientBuilder.create().clientId("custom-scheme").name("custom-scheme").redirectUris("android-app://org.keycloak.examples.cordova/https/keycloak-cordova-example.github.io/login").secret("password");
realm.client(installedAppCustomScheme);
ClientBuilder installedAppLoopback = ClientBuilder.create().clientId("test-installed-loopback").name("test-installed-loopback").redirectUris(Constants.INSTALLED_APP_LOOPBACK).secret("password");
realm.client(installedAppLoopback);
ClientBuilder installedAppLoopback2 = ClientBuilder.create().clientId("test-installed-loopback2").name("test-installed-loopback2").redirectUris(Constants.INSTALLED_APP_LOOPBACK + "/myapp").secret("password");
realm.client(installedAppLoopback2);
testRealms.add(realm.build());
}
Aggregations