This is an automated email from the ASF dual-hosted git repository.

bhliva pushed a commit to branch dlab_refactored
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/dlab_refactored by this push:
     new 0e25ee7  DLAB-000 replaced hardcoded realm
0e25ee7 is described below

commit 0e25ee7fde538877962075de7d7843bd9f44ba15
Author: bhliva <[email protected]>
AuthorDate: Fri Aug 2 16:22:27 2019 +0300

    DLAB-000 replaced hardcoded realm
---
 .../java/com/epam/dlab/backendapi/service/KeycloakServiceImpl.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/KeycloakServiceImpl.java
 
b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/KeycloakServiceImpl.java
index 4631a86..6afba62 100644
--- 
a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/KeycloakServiceImpl.java
+++ 
b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/KeycloakServiceImpl.java
@@ -17,7 +17,7 @@ import javax.ws.rs.core.Response;
 @Slf4j
 public class KeycloakServiceImpl implements KeycloakService {
 
-       private static final String URI = 
"/realms/DLAB_bhliva/protocol/openid-connect/token";
+       private static final String URI = 
"/realms/%s/protocol/openid-connect/token";
        private final Client httpClient;
        private final KeycloakConfiguration conf;
 
@@ -40,7 +40,8 @@ public class KeycloakServiceImpl implements KeycloakService {
        private AccessTokenResponse requestToken(Form requestForm) {
                final String credentials = 
Base64.encodeAsString(String.join(":", conf.getResource(),
                                
String.valueOf(conf.getCredentials().get("secret"))));
-               final Response response = 
httpClient.target(conf.getAuthServerUrl() + URI).request()
+               final Response response =
+                               httpClient.target(conf.getAuthServerUrl() + 
String.format(URI, conf.getRealm())).request()
                                .header(HttpHeaders.AUTHORIZATION, "Basic " + 
credentials)
                                .post(Entity.form(requestForm));
                if (response.getStatusInfo().getFamily() != 
Response.Status.Family.SUCCESSFUL) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to