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
This commit is contained in:
parent
fb75255689
commit
21c8a9a848
|
@ -10,21 +10,21 @@
|
||||||
|
|
||||||
<%
|
<%
|
||||||
if (redirect.startsWith(siteUrl + GCubePortalConstants.AUTHORIZATION_FRIENDLY_URL)) {
|
if (redirect.startsWith(siteUrl + GCubePortalConstants.AUTHORIZATION_FRIENDLY_URL)) {
|
||||||
hideCreateAccountAndForgotPassword = true;
|
|
||||||
Map<String, String> 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) {
|
|
||||||
%>
|
%>
|
||||||
<script>
|
<script>
|
||||||
$(".portlet-title-text").text("Sign in to approve application");
|
$(".portlet-title-text").text("Sign in to approve application");
|
||||||
</script>
|
</script>
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<%
|
<%
|
||||||
if (app.getLogoURL() != null && !app.getLogoURL().isEmpty()) {
|
hideCreateAccountAndForgotPassword = true;
|
||||||
|
Map<String, String> 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()) {
|
||||||
%>
|
%>
|
||||||
<p>
|
<p>
|
||||||
<img style="width: 100px;" src="<%=app.getLogoURL()%>" />
|
<img style="width: 100px;" src="<%=app.getLogoURL()%>" />
|
||||||
|
@ -53,7 +53,16 @@
|
||||||
</div>
|
</div>
|
||||||
<%
|
<%
|
||||||
} else {
|
} else {
|
||||||
System.out.println(
|
%>
|
||||||
|
<p class="lead">We're sorry your application is not authorised by
|
||||||
|
D4Science</p>
|
||||||
|
<p style="color: red;">
|
||||||
|
The client_id does not exist or something occurred in retrieving it
|
||||||
|
from the Information System: " (<%=clientId%>)
|
||||||
|
</p>
|
||||||
|
<%
|
||||||
|
clientNotAuthorised = true;
|
||||||
|
System.out.println(
|
||||||
"The client_id does not exist or something occurred in retrieving it from IS: "
|
"The client_id does not exist or something occurred in retrieving it from IS: "
|
||||||
+ clientId);
|
+ clientId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
final String GET_CLIENT_ID_PARAMETER = "client_id";
|
final String GET_CLIENT_ID_PARAMETER = "client_id";
|
||||||
final String GET_SCOPE_PARAMETER = "scope";
|
final String GET_SCOPE_PARAMETER = "scope";
|
||||||
boolean hideCreateAccountAndForgotPassword = false;
|
boolean hideCreateAccountAndForgotPassword = false;
|
||||||
|
boolean clientNotAuthorised = false;
|
||||||
%>
|
%>
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="<%=themeDisplay.isSignedIn()%>">
|
<c:when test="<%=themeDisplay.isSignedIn()%>">
|
||||||
|
@ -105,8 +106,9 @@
|
||||||
var="loginURL">
|
var="loginURL">
|
||||||
<portlet:param name="struts_action" value="/login/login" />
|
<portlet:param name="struts_action" value="/login/login" />
|
||||||
</portlet:actionURL>
|
</portlet:actionURL>
|
||||||
|
<!-- START CLIENT NOT AUTHORISED -->
|
||||||
|
<c:if test="<%=clientNotAuthorised == false%>">
|
||||||
|
|
||||||
<aui:form action="<%=loginURL%>"
|
<aui:form action="<%=loginURL%>"
|
||||||
autocomplete='<%=PropsValues.COMPANY_SECURITY_LOGIN_FORM_AUTOCOMPLETE ? "on" : "off"%>'
|
autocomplete='<%=PropsValues.COMPANY_SECURITY_LOGIN_FORM_AUTOCOMPLETE ? "on" : "off"%>'
|
||||||
cssClass="sign-in-form" method="post" name="fm">
|
cssClass="sign-in-form" method="post" name="fm">
|
||||||
|
@ -258,7 +260,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
<!-- END CLIENT NOT AUTHORISED -->
|
||||||
|
</c:if>
|
||||||
|
|
||||||
<aui:script use="aui-base">
|
<aui:script use="aui-base">
|
||||||
var password = A.one('#<portlet:namespace />password');
|
var password = A.one('#<portlet:namespace />password');
|
||||||
|
|
Loading…
Reference in New Issue