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/23 12:53:19 UTC

[incubator-dlab] branch DLAB-terraform updated (d3f3596 -> 438b3f2)

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

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


    from d3f3596  [DLAB-758]: added logout with keyclock redirect
     new dfb0134  Merge branch 'DLAB-terraform' of /Users/bohdan.hliva/IdeaProjects/incubator-dlab with conflicts.
     new c08a159  Merge remote-tracking branch 'origin/DLAB-terraform' into DLAB-terraform
     new 438b3f2  DLAB-000 added possibility to logout

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 services/self-service/self-service.yml             |  1 +
 .../backendapi/conf/KeycloakConfiguration.java     |  8 +++++
 .../conf/SelfServiceApplicationConfiguration.java  |  1 -
 .../backendapi/resources/KeycloakResource.java     | 35 +++++++++++-----------
 4 files changed, 27 insertions(+), 18 deletions(-)
 create mode 100644 services/self-service/src/main/java/com/epam/dlab/backendapi/conf/KeycloakConfiguration.java


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


[incubator-dlab] 02/03: Merge remote-tracking branch 'origin/DLAB-terraform' into DLAB-terraform

Posted by bh...@apache.org.
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

commit c08a1599c8600d28ada0d63ab1342e4e5e78d646
Merge: dfb0134 d3f3596
Author: bhliva <bo...@epam.com>
AuthorDate: Mon Sep 23 14:54:29 2019 +0300

    Merge remote-tracking branch 'origin/DLAB-terraform' into DLAB-terraform

 .../resources/webapp/src/app/core/services/appRouting.service.ts     | 4 ++++
 .../webapp/src/app/core/services/applicationSecurity.service.ts      | 3 +--
 .../webapp/src/app/core/services/applicationServiceFacade.service.ts | 4 ++--
 .../main/resources/webapp/src/app/shared/navbar/navbar.component.ts  | 5 +++--
 4 files changed, 10 insertions(+), 6 deletions(-)


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


[incubator-dlab] 01/03: Merge branch 'DLAB-terraform' of /Users/bohdan.hliva/IdeaProjects/incubator-dlab with conflicts.

Posted by bh...@apache.org.
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

commit dfb0134d6b00437b0044ecf26d9f3439f7d52313
Author: bhliva <bo...@epam.com>
AuthorDate: Mon Sep 23 14:52:06 2019 +0300

    Merge branch 'DLAB-terraform' of /Users/bohdan.hliva/IdeaProjects/incubator-dlab with conflicts.
---
 .../src/main/resources/webapp/src/dictionary/global.dictionary.ts     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts b/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts
index 6d0d8ea..437016f 100644
--- a/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts
+++ b/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts
@@ -19,8 +19,8 @@
 
 // from './{{ aws | gcp | azure }}.dictionary';
 
-import { NAMING_CONVENTION } from './CLOUD_PROVIDER.dictionary';
+import { NAMING_CONVENTION } from './aws.dictionary';
 
-export * from './CLOUD_PROVIDER.dictionary';
+export * from './aws.dictionary';
 
 export const DICTIONARY = Object.freeze(NAMING_CONVENTION);


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


[incubator-dlab] 03/03: DLAB-000 added possibility to logout

Posted by bh...@apache.org.
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

commit 438b3f2c3a4f33399ba24e379e0180a0a716ed73
Author: bhliva <bo...@epam.com>
AuthorDate: Mon Sep 23 15:51:54 2019 +0300

    DLAB-000 added possibility to logout
---
 services/self-service/self-service.yml             |  1 +
 .../backendapi/conf/KeycloakConfiguration.java     |  8 +++++
 .../conf/SelfServiceApplicationConfiguration.java  |  1 -
 .../backendapi/resources/KeycloakResource.java     | 35 +++++++++++-----------
 .../webapp/src/dictionary/global.dictionary.ts     |  4 +--
 5 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/services/self-service/self-service.yml b/services/self-service/self-service.yml
index b571cf1..86a3834 100644
--- a/services/self-service/self-service.yml
+++ b/services/self-service/self-service.yml
@@ -177,6 +177,7 @@ guacamole:
   username: dlab-user
 
 keycloakConfiguration:
+  redirectUri: REDIRECT_URI
   realm: KEYCLOAK_REALM_NAME
   bearer-only: true
   auth-server-url: KEYCLOAK_AUTH_SERVER_URL
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/KeycloakConfiguration.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/KeycloakConfiguration.java
new file mode 100644
index 0000000..b252de9
--- /dev/null
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/KeycloakConfiguration.java
@@ -0,0 +1,8 @@
+package com.epam.dlab.backendapi.conf;
+
+import lombok.Data;
+
+@Data
+public class KeycloakConfiguration extends de.ahus1.keycloak.dropwizard.KeycloakConfiguration {
+	private String redirectUri;
+}
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/SelfServiceApplicationConfiguration.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/SelfServiceApplicationConfiguration.java
index d6392a5..4494d01 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/SelfServiceApplicationConfiguration.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/SelfServiceApplicationConfiguration.java
@@ -28,7 +28,6 @@ import com.epam.dlab.validation.AwsValidation;
 import com.epam.dlab.validation.AzureValidation;
 import com.epam.dlab.validation.GcpValidation;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import de.ahus1.keycloak.dropwizard.KeycloakConfiguration;
 import io.dropwizard.client.JerseyClientConfiguration;
 import io.dropwizard.util.Duration;
 import io.federecio.dropwizard.swagger.SwaggerBundleConfiguration;
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeycloakResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeycloakResource.java
index fae5418..0d7a0db 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeycloakResource.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeycloakResource.java
@@ -1,40 +1,46 @@
 package com.epam.dlab.backendapi.resources;
 
 import com.epam.dlab.auth.UserInfo;
+import com.epam.dlab.backendapi.conf.KeycloakConfiguration;
 import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration;
 import com.epam.dlab.backendapi.service.SecurityService;
 import com.google.inject.Inject;
 import io.dropwizard.auth.Auth;
 
-import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import java.net.URI;
 import java.net.URISyntaxException;
 
+import static java.lang.String.format;
+
 @Path("/oauth")
 public class KeycloakResource {
 	private static final String LOGIN_URI_FORMAT = "%s/realms/%s/protocol/openid-connect/auth?client_id=%s" +
 			"&response_type=code";
-	private static final String LOGOUT_URI_FORMAT = "%s/realms/%s/protocol/openid-connect/logout?redirect_uri=";
+	private static final String KEYCLOAK_LOGOUT_URI_FORMAT = "%s/realms/%s/protocol/openid-connect/logout" +
+			"?redirect_uri=";
 	private final SecurityService securityService;
 	private final String loginUri;
 	private final String logoutUri;
+	private final String redirectUri;
 
 	@Inject
 	public KeycloakResource(SecurityService securityService, SelfServiceApplicationConfiguration configuration) {
+		final KeycloakConfiguration keycloakConfiguration = configuration.getKeycloakConfiguration();
+		this.redirectUri = keycloakConfiguration.getRedirectUri();
 		this.securityService = securityService;
+
 		loginUri =
-				String.format(LOGIN_URI_FORMAT,
-						configuration.getKeycloakConfiguration().getAuthServerUrl(),
-						configuration.getKeycloakConfiguration().getRealm(),
-						configuration.getKeycloakConfiguration().getResource());
+				format(LOGIN_URI_FORMAT,
+						keycloakConfiguration.getAuthServerUrl(),
+						keycloakConfiguration.getRealm(),
+						keycloakConfiguration.getResource());
 		logoutUri =
-				String.format(LOGOUT_URI_FORMAT,
-						configuration.getKeycloakConfiguration().getAuthServerUrl(),
-						configuration.getKeycloakConfiguration().getRealm());
+				format(KEYCLOAK_LOGOUT_URI_FORMAT,
+						keycloakConfiguration.getAuthServerUrl(),
+						keycloakConfiguration.getRealm());
 	}
 
 	@GET
@@ -58,14 +64,9 @@ public class KeycloakResource {
 
 	@GET
 	@Path("/logout")
-	public Response logout(final @Context HttpServletRequest request) throws URISyntaxException {
-		StringBuilder redirectUri = new StringBuilder(logoutUri);
-		redirectUri.append(request.getScheme());
-		redirectUri.append("://");
-		redirectUri.append(request.getServerName());
-		redirectUri.append("/#/login");
+	public Response getLogoutUrl() throws URISyntaxException {
 		return Response.noContent()
-				.location(new URI(redirectUri.toString()))
+				.location(new URI(logoutUri + redirectUri))
 				.build();
 	}
 }
diff --git a/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts b/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts
index 437016f..6d0d8ea 100644
--- a/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts
+++ b/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts
@@ -19,8 +19,8 @@
 
 // from './{{ aws | gcp | azure }}.dictionary';
 
-import { NAMING_CONVENTION } from './aws.dictionary';
+import { NAMING_CONVENTION } from './CLOUD_PROVIDER.dictionary';
 
-export * from './aws.dictionary';
+export * from './CLOUD_PROVIDER.dictionary';
 
 export const DICTIONARY = Object.freeze(NAMING_CONVENTION);


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