/
login.xhtml
153 lines (133 loc) · 6.11 KB
/
login.xhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
template="/WEB-INF/incl/layout/template.xhtml">
<ui:define name="head">
<link rel="stylesheet" href="#{oxAuthConfigurationService.cssLocation}/jquery-ui-1.12.1.min.css"/>
<script src="#{oxAuthConfigurationService.jsLocation}/jquery-1.12.4.min.js"/>
<script src="#{oxAuthConfigurationService.jsLocation}/jquery.qrcode-0.12.0.min.js"/>
<script src="#{oxAuthConfigurationService.jsLocation}/jquery-ui-1.12.1.min.js"/>
<script src="../../js/gluu-auth.js"/>
<script>
var helper = (function() {
var authResult = undefined;
return {
/**
* Resume on getting authentication result from server
*/
onSignInCallback: function(authResult) {
console.log('Get authentication result: ' + authResult);
helper.resumeAuthentication(authResult);
},
/**
* Send form to server to resume authentication workflow
*/
resumeAuthentication: function(authResult) {
$('input#auth_result').val(authResult);
$('form#response').submit();
},
};
})();
/**
* Calls the helper method that handles the authentication flow.
*/
function onSignInCallback(authResult) {
helper.onSignInCallback(authResult);
}
var request = '${super_gluu_request}';
var label = '${super_gluu_label}';
var qr_options = ${super_gluu_qr_options};
$(document).ready(function() {
if (request == '') {
onSignInCallback('error');
}
gluu_auth.renderQrCode('#container', request, qr_options, label);
gluu_auth.startProgressBar('#progressbar', 60, onSignInCallback);
gluu_auth.startSessionChecker(onSignInCallback, 60);
});
</script>
<style type="text/css">
.login-panel {
border-style: solid;
border-width: 1px;
padding: 1px;
background-color: #FFFFFF;
border-color: #C4C0B9;
}
.login-panel-header {
background-color: #D4CFC7;
background-image: url("#{oxAuthConfigurationService.getImgLocation()}/panel_header_bg.png");
background-position: left top;
background-repeat: repeat-x;
border-style: solid;
border-width: 1px;
padding: 2px;
border-color: #D4CFC7;
color: #000000;
font-family: Arial, Verdana, sans-serif;
font-size: 11px;
font-weight: bold;
}
.login-panel-body {
padding: 10px;
color: #000000;
font-family: Arial, Verdana, sans-serif;
font-size: 11px;
}
</style>
</ui:define>
<ui:define name="pageTitle">oxAuth - Super-Gluu Login</ui:define>
<ui:define name="body">
<form method="post" id="response" action="#{request.contextPath}/postlogin">
<input type="hidden" id="auth_result" name="auth_result" />
</form>
<table border="0" align="center">
<tr>
<td>
<div>
<h:form id="loginForm">
<s:token allowMultiplePosts="true"/>
<h:panelGroup rendered="#{not identity.loggedIn}">
<div class="login-panel">
<div class="login-panel-header">
<h:outputText value="#{messages['login.login']}"/>
</div>
<div class="login-panel-body">
<ui:param name="client" value="#{clientService.getClient(sessionAttributes['client_id'])}" />
<s:div rendered='#{!empty client.getLogoUri()}'>
<h:graphicImage url='#{client.getLogoUri()}'/>
</s:div>
<div class="dialog">
<p>Scan QR code using Super-Gluu</p>
<div id="container"></div>
<div id="progressbar"></div>
</div>
<s:div rendered='#{!empty client.getPolicyUri()}'>
<p>
<h:outputText value="#{messages['common.agreePolicy']}"/>
<a target="_blank" href='#{client.getPolicyUri()}'>
<h:outputText value="#{messages['common.privacyPolicy']}"/>
</a>
</p>
</s:div>
<s:div rendered='#{!empty client.getTosUri()}'>
<p>
<h:outputText value="#{messages['common.pleaseReadTheTos']}"/>
<a target="_blank" href='#{client.getTosUri()}'>
<h:outputText value="#{messages['common.termsOfService']}"/>
</a>
</p>
</s:div>
</div>
</div>
</h:panelGroup>
</h:form>
</div>
</td>
</tr>
</table>
</ui:define>
</ui:composition>