You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by bh...@apache.org on 2019/09/18 08:09:29 UTC

[incubator-dlab] branch DLAB-terraform updated: DLAB-000 removed caching user on DLab side

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

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


The following commit(s) were added to refs/heads/DLAB-terraform by this push:
     new 9359f3e  DLAB-000 removed caching user on DLab side
9359f3e is described below

commit 9359f3e843190c32ac580da9011ddda5c3996f41
Author: bhliva <bo...@epam.com>
AuthorDate: Wed Sep 18 11:09:18 2019 +0300

    DLAB-000 removed caching user on DLab side
---
 .../epam/dlab/backendapi/auth/KeycloakAuthenticator.java  | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/auth/KeycloakAuthenticator.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/auth/KeycloakAuthenticator.java
index 9d30cca..5c24010 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/auth/KeycloakAuthenticator.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/auth/KeycloakAuthenticator.java
@@ -1,17 +1,13 @@
 package com.epam.dlab.backendapi.auth;
 
 import com.epam.dlab.auth.UserInfo;
-import com.epam.dlab.backendapi.SelfServiceApplication;
-import com.epam.dlab.backendapi.dao.SecurityDAO;
 import de.ahus1.keycloak.dropwizard.AbstractKeycloakAuthenticator;
 import de.ahus1.keycloak.dropwizard.KeycloakConfiguration;
 import io.dropwizard.auth.AuthenticationException;
-import org.apache.commons.lang3.StringUtils;
 import org.keycloak.KeycloakSecurityContext;
 import org.keycloak.representations.AccessToken;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.core.HttpHeaders;
 import java.util.List;
 import java.util.Optional;
 
@@ -19,7 +15,6 @@ import static java.util.Collections.emptyList;
 
 public class KeycloakAuthenticator extends AbstractKeycloakAuthenticator<UserInfo> {
 
-	private static final String TOKEN_PREFIX = "Bearer ";
 	private static final String GROUPS_CLAIM = "groups";
 
 	public KeycloakAuthenticator(KeycloakConfiguration keycloakConfiguration) {
@@ -28,14 +23,8 @@ public class KeycloakAuthenticator extends AbstractKeycloakAuthenticator<UserInf
 
 	@Override
 	public Optional<UserInfo> authenticate(HttpServletRequest request) throws AuthenticationException {
-		final String token = StringUtils.substringAfter(request.getHeader(HttpHeaders.AUTHORIZATION), TOKEN_PREFIX);
-		final Optional<UserInfo> cachedUser =
-				SelfServiceApplication.getInjector().getInstance(SecurityDAO.class).getUser(token);
-		if (!cachedUser.isPresent()) {
-			return super.authenticate(request);
-		} else {
-			return cachedUser;
-		}
+		return super.authenticate(request);
+
 	}
 
 	@Override


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org