Skip to content

Commit

Permalink
configure travis ci
Browse files Browse the repository at this point in the history
commit 3b56b80
Author: fbernard <[email protected]>
Date:   Sat Dec 1 00:51:27 2018 +0100

    fix travis

commit c6c0e02
Author: fbernard <[email protected]>
Date:   Sat Dec 1 00:45:57 2018 +0100

    fix travis

commit b4bdda6
Author: fbernard <[email protected]>
Date:   Sat Dec 1 00:42:02 2018 +0100

    fix travis

commit 4cfb1ed
Author: fbernard <[email protected]>
Date:   Sat Dec 1 00:37:57 2018 +0100

    fix travis

commit 7946c49
Author: fbernard <[email protected]>
Date:   Sat Dec 1 00:30:04 2018 +0100

    fix travis

commit 6d5457e
Author: fbernard <[email protected]>
Date:   Sat Dec 1 00:24:50 2018 +0100

    fix ipv6 on travis

commit 672a356
Author: fbernard <[email protected]>
Date:   Sat Dec 1 00:17:57 2018 +0100

    fix ipv6 on travis

commit fe5d1b1
Author: fbernard <[email protected]>
Date:   Sat Dec 1 00:12:41 2018 +0100

    update docker command

commit 3c6d424
Merge: 567a4d7 94c3487
Author: fbernard <[email protected]>
Date:   Sat Dec 1 00:07:00 2018 +0100

    Merge branch 'travis-test' of https://github.com/fb64/elastic-keycloak-plugin into travis-test

commit 567a4d7
Author: fbernard <[email protected]>
Date:   Fri Nov 30 23:57:50 2018 +0100

    add missing port binding

commit 94c3487
Author: fbernard <[email protected]>
Date:   Fri Nov 30 23:57:50 2018 +0100

    using ip instead of localhost to allow test passing on travis

commit b14fd0f
Author: fbernard <[email protected]>
Date:   Fri Nov 30 23:47:38 2018 +0100

    update java version on travis
  • Loading branch information
fbernard committed Dec 1, 2018
1 parent 1122b33 commit f78bb8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
language: java

jdk:
- oraclejdk9
- openjdk10

services:
- docker


before_install:
- docker pull jboss/keycloak:4.5.0.Final
- docker run -d -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e KEYCLOAK_IMPORT=/tmp/elastic-realm-export.json -v "$(TRAVIS_BUILD_DIR)"/src/test/resources/config/elastic-realm-export.json:/tmp/elastic-realm-export.json jboss/keycloak:4.5.0.Final
- docker run -d -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e KEYCLOAK_IMPORT=/tmp/elastic-realm-export.json -v "${TRAVIS_BUILD_DIR}"/src/test/resources/config/elastic-realm-export.json:/tmp/elastic-realm-export.json -p 8080:8080 jboss/keycloak

install:
- ./gradlew assemble
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@
public class KeycloakUtils {

private static HttpClient httpClient = HttpClients.createDefault();
private static final String KEYCLOAK_BASE_URL="http://localhost:8080";

public static void addUser(String username,String password) throws IOException {
String adminToken = getKeycloakAdminToken("admin","admin");
HttpPost httpPost = new HttpPost("http://localhost:8080/auth/admin/realms/elastic/users");
HttpPost httpPost = new HttpPost(KEYCLOAK_BASE_URL.concat("/auth/admin/realms/elastic/users"));
httpPost.setHeader(HttpHeaders.AUTHORIZATION,"Bearer "+adminToken);

StringBuilder request = new StringBuilder();
Expand All @@ -57,7 +58,7 @@ public static void addUser(String username,String password) throws IOException {


private static String getKeycloakAdminToken(String username,String password){
HttpPost httpPost = new HttpPost("http://localhost:8080/auth/realms/master/protocol/openid-connect/token");
HttpPost httpPost = new HttpPost(KEYCLOAK_BASE_URL.concat("/auth/realms/master/protocol/openid-connect/token"));
List<NameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair("grant_type", "password"));
params.add(new BasicNameValuePair("username", username));
Expand All @@ -75,7 +76,7 @@ private static String getKeycloakAdminToken(String username,String password){
}

public static String getKeycloakUserToken(String username,String password){
HttpPost httpPost = new HttpPost("http://localhost:8080/auth/realms/elastic/protocol/openid-connect/token");
HttpPost httpPost = new HttpPost(KEYCLOAK_BASE_URL.concat("/auth/realms/elastic/protocol/openid-connect/token"));
List<NameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair("grant_type", "password"));
params.add(new BasicNameValuePair("username", username));
Expand Down

0 comments on commit f78bb8d

Please sign in to comment.