...

Custom Login Page pada CAS Client

Oh iya Sebelumnya sudah ada konfigurasi mengenai cas client dan cas server, sekarang saya mencoba custom login page pada cas client. Terkadang user tidak mau untuk melakukan login pada halaman login default yang disediakan oleh CAS ini. Nah disini akan sedikit dijelaskan mengenai custom login page tersebut. User dapat mengubah login page sesuka hati, asalkan tidak melupakan poin poin pentingnya. Let’s cekidot broh..

1. Pada aplikasi yang menggunakan CAS dapat menambahkan script seperti berikut :

<form method="get" action="https://server.cas/cas/login" class="form-horizontal">
 <div class="control-group">
   <label class="control-label" for="InputUsername">Username</label>
      <input type="text" name="username" value="" placeholder="Minimal 5-20 Karakter" required >
 </div>
 <div class="control-group">
   <label class="control-label" for="InputPassword">Password</label>
      <input type="password" name="password" value="" placeholder="minimal 6-8 karakter" required >					
 </div>
 <div class="control-group">
    <input type="hidden" name="auto" value="true" />
    <input type="hidden" name="service" value="http://aplikasi.client" />
    <input type="submit" name="login" value="Login" />
 </div>
</form>

2. Ganti kode yang ada pada halaman casLoginPage.jsp pada CAS SERVER :

<%@ page contentType="text/html; charset=UTF-8" %>
<%
String auto = request.getParameter("auto");
if (auto != null && auto.equals("true")) {
%>
<html>
    <head>
        <script language="javascript">
            function doAutoLogin() {
                document.forms[0].submit();
            }
        </script>
    </head>
    <body onload="doAutoLogin();">
        <form id="credentials" method="POST" action="<%= request.getContextPath() %>/login?service=<%= request.getParameter("service") %>"> 
            <input type="hidden" name="lt" value="${flowExecutionKey}" />
            <input type="hidden" name="execution" value="${flowExecutionKey}" />
            <input type="hidden" name="_eventId" value="submit" />
            <input type="hidden" name="username" value="<%= request.getParameter("username") %>" />
            <input type="hidden" name="password" value="<%= request.getParameter("password") %>" />
            <% if ("true".equals(request.getParameter("rememberMe"))) {%>
                <input type="hidden" name="rememberMe" value="true" />
            <% } %>

            <input type="submit" value="Submit" style="visibility: hidden;" />
        </form>
    </body>
</html>
<%
} else {
%>
<jsp:directive.include file="includes/top.jsp" />
...
<jsp:directive.include file="includes/bottom.jsp" />
<%
}
%>

3. Restart server CAS

service tomcat6 restart

 

Oke selesai.. Selamat mencoba… Selamat menikmati hidangan

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Seraphinite AcceleratorOptimized by Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.