Examples of realms()


Examples of org.keycloak.models.KeycloakSession.realms()

        // test SSO
        driver.navigate().to("http://localhost:8081/product-portal");
        Assert.assertTrue(driver.getCurrentUrl().startsWith(LOGIN_URL));

        session = keycloakRule.startSession();
        realm = session.realms().getRealmByName("demo");
        // need to cleanup so other tests don't fail, so invalidate http sessions on remote clients.
        UserModel user = session.users().getUserByUsername("bburke@redhat.com", realm);
        new ResourceAdminManager().logoutUser(null, realm, user, session);
        realm.setSsoSessionIdleTimeout(originalIdle);
        session.getTransaction().commit();
View Full Code Here

Examples of org.keycloak.models.KeycloakSession.realms()

        String pageSource = driver.getPageSource();
        System.out.println(pageSource);
        Assert.assertTrue(pageSource.contains("Bill Burke") && pageSource.contains("Stian Thorgersen"));

        KeycloakSession session = keycloakRule.startSession();
        RealmModel realm = session.realms().getRealmByName("demo");
        int original = realm.getSsoSessionMaxLifespan();
        realm.setSsoSessionMaxLifespan(1);
        session.getTransaction().commit();
        session.close();
View Full Code Here

Examples of org.keycloak.models.KeycloakSession.realms()

        // test SSO
        driver.navigate().to("http://localhost:8081/product-portal");
        Assert.assertTrue(driver.getCurrentUrl().startsWith(LOGIN_URL));

        session = keycloakRule.startSession();
        realm = session.realms().getRealmByName("demo");
        realm.setSsoSessionMaxLifespan(original);
        session.getTransaction().commit();
        session.close();
    }
View Full Code Here

Examples of org.keycloak.models.KeycloakSession.realms()

    @Test
    public void testTokenInCookieRefresh() throws Throwable {
        // Set token timeout 1 sec
        KeycloakSession session = keycloakRule.startSession();
        RealmModel realm = session.realms().getRealmByName("demo");
        int originalTokenTimeout = realm.getAccessTokenLifespan();
        realm.setAccessTokenLifespan(1);
        session.getTransaction().commit();
        session.close();
View Full Code Here

Examples of org.keycloak.models.KeycloakSession.realms()

        driver.navigate().to("http://localhost:8081/customer-cookie-portal");
        Assert.assertTrue(driver.getCurrentUrl().startsWith(LOGIN_URL));

        // Change timeout back
        session = keycloakRule.startSession();
        realm = session.realms().getRealmByName("demo");
        realm.setAccessTokenLifespan(originalTokenTimeout);
        session.getTransaction().commit();
        session.close();
    }
View Full Code Here

Examples of org.keycloak.models.KeycloakSession.realms()

    public UserRepresentation getUserById(String realm, String id) {
        KeycloakSession session = server.getSessionFactory().create();
        session.getTransaction().begin();
        try {
            RealmModel realmByName = session.realms().getRealmByName(realm);
            UserRepresentation userRep = ModelToRepresentation.toRepresentation(session.users().getUserById(id, realmByName));
            session.getTransaction().commit();
            return userRep;
        } finally {
            session.close();
View Full Code Here

Examples of org.keycloak.models.KeycloakSession.realms()

    }


    public void removeUserSession(String sessionId) {
        KeycloakSession session = startSession();
        RealmModel realm = session.realms().getRealm("test");
        UserSessionModel userSession = session.sessions().getUserSession(realm, sessionId);
        assertNotNull(userSession);
        session.sessions().removeUserSession(realm, userSession);
        stopSession(session, true);
    }
View Full Code Here

Examples of org.keycloak.models.KeycloakSession.realms()

    }

    public ClientSessionCode verifyCode(String code) {
        KeycloakSession session = startSession();
        try {
            RealmModel realm = session.realms().getRealm("test");
            try {
                ClientSessionCode accessCode = ClientSessionCode.parse(code, session, realm);
                if (accessCode == null) {
                    Assert.fail("Invalid code");
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.