From 21c8a9a8486790c57cba3c445cc67284847e3f70 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Wed, 1 Feb 2017 17:12:45 +0000 Subject: [PATCH] added extensio to support oAuth2 requesting applications with error handling git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/liferay62-plugins/login-hook@142016 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../portlet/login/RequestingApplication.jsp | 29 ++++++++++++------- .../custom_jsps/html/portlet/login/login.jsp | 9 ++++-- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/main/webapp/META-INF/custom_jsps/html/portlet/login/RequestingApplication.jsp b/src/main/webapp/META-INF/custom_jsps/html/portlet/login/RequestingApplication.jsp index 0c07ff0..149acd4 100644 --- a/src/main/webapp/META-INF/custom_jsps/html/portlet/login/RequestingApplication.jsp +++ b/src/main/webapp/META-INF/custom_jsps/html/portlet/login/RequestingApplication.jsp @@ -10,21 +10,21 @@ <% if (redirect.startsWith(siteUrl + GCubePortalConstants.AUTHORIZATION_FRIENDLY_URL)) { - hideCreateAccountAndForgotPassword = true; - Map queryMap = AuthUtil.getQueryMap(redirect); - if (!queryMap.isEmpty()) { - String clientId = queryMap.get(GET_CLIENT_ID_PARAMETER); - String scope = queryMap.get(GET_SCOPE_PARAMETER); - if (clientId != null && clientId.compareTo("") != 0) { - RequestingApp app = AuthUtil.getAuthorisedApplicationInfoFromIs(clientId); - if (app != null) { %>
<% - if (app.getLogoURL() != null && !app.getLogoURL().isEmpty()) { + hideCreateAccountAndForgotPassword = true; + Map queryMap = AuthUtil.getQueryMap(redirect); + if (!queryMap.isEmpty()) { + String clientId = queryMap.get(GET_CLIENT_ID_PARAMETER); + String scope = queryMap.get(GET_SCOPE_PARAMETER); + if (clientId != null && clientId.compareTo("") != 0) { + RequestingApp app = AuthUtil.getAuthorisedApplicationInfoFromIs(clientId); + if (app != null) { + if (app.getLogoURL() != null && !app.getLogoURL().isEmpty()) { %>

@@ -53,7 +53,16 @@

<% } else { - System.out.println( +%> +

We're sorry your application is not authorised by + D4Science

+

+ The client_id does not exist or something occurred in retrieving it + from the Information System: " (<%=clientId%>) +

+<% + clientNotAuthorised = true; + System.out.println( "The client_id does not exist or something occurred in retrieving it from IS: " + clientId); } diff --git a/src/main/webapp/META-INF/custom_jsps/html/portlet/login/login.jsp b/src/main/webapp/META-INF/custom_jsps/html/portlet/login/login.jsp index facac9d..5bd702c 100644 --- a/src/main/webapp/META-INF/custom_jsps/html/portlet/login/login.jsp +++ b/src/main/webapp/META-INF/custom_jsps/html/portlet/login/login.jsp @@ -41,6 +41,7 @@ final String GET_CLIENT_ID_PARAMETER = "client_id"; final String GET_SCOPE_PARAMETER = "scope"; boolean hideCreateAccountAndForgotPassword = false; + boolean clientNotAuthorised = false; %> @@ -105,8 +106,9 @@ var="loginURL"> - - + + + @@ -258,7 +260,8 @@ - + + var password = A.one('#password');