airavata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcus Christie (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRAVATA-2450) Keycloak: restrictions on what is allowed for realm ids?
Date Fri, 23 Jun 2017 19:48:00 GMT

    [ https://issues.apache.org/jira/browse/AIRAVATA-2450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16061423#comment-16061423
] 

Marcus Christie commented on AIRAVATA-2450:
-------------------------------------------

Code I used to test:

{code}
        FileInputStream fis = null;
        KeyStore ks = null;
        try {
            fis = new java.io.FileInputStream("/Users/machrist/Airavata/airavata/modules/configuration/server/src/main/resources/client_truststore.jks");
            ks = KeyStore.getInstance(KeyStore.getDefaultType());
            ks.load(fis, "airavata".toCharArray());
        } catch (Exception e) {
            throw new RuntimeException("Failed to load trust store KeyStore instance", e);
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    logger.error("Failed to close trust store FileInputStream", e);
                }
            }
        }

        String adminUrl = "https://iamdev.scigap.org/auth";
        String realm = "master";
        String username = "<redacted>";
        String password = "<redacted>";

        ResteasyClient resteasyClient = new ResteasyClientBuilder()
                .connectionPoolSize(10)
                .trustStore(ks)
                .build();
        Keycloak client = KeycloakBuilder.builder()
                .serverUrl(adminUrl)
                .realm(realm)
                .username(username)
                .password(password)
                .clientId("admin-cli")
                .resteasyClient(resteasyClient)
                .build();

        // create realm
        RealmRepresentation newRealmDetails = new RealmRepresentation();
        newRealmDetails.setEnabled(true);
        newRealmDetails.setId("abc-123");
        newRealmDetails.setDisplayName("ABC 123");
        newRealmDetails.setRealm("abc-123");
        // Following two settings allow duplicate email addresses
        newRealmDetails.setLoginWithEmailAllowed(false);
        newRealmDetails.setDuplicateEmailsAllowed(true);
        client.realms().create(newRealmDetails);
        List<RealmRepresentation> realms = client.realms().findAll();
        for (RealmRepresentation realmRepresentation : realms) {
            System.out.println("Realm: " + realmRepresentation.getId() + ", name=" + realmRepresentation.getRealm()
+ ", description=" + realmRepresentation.getDisplayName());
        }

{code}

> Keycloak: restrictions on what is allowed for realm ids?
> --------------------------------------------------------
>
>                 Key: AIRAVATA-2450
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2450
>             Project: Airavata
>          Issue Type: Bug
>            Reporter: Marcus Christie
>            Assignee: Marcus Christie
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message