Permalink
Browse files

Adding static users and passwords. Adding login page and forcing it to

users.
  • Loading branch information...
1 parent 03d7827 commit ec89bac92a445d8f13c47d5be10d01befe0dcbfe meri committed Mar 13, 2011
@@ -0,0 +1,18 @@
+[main]
+authc.loginUrl = /simpleshirosecuredapplication/account/login.jsp
+authc.usernameParam = user
+authc.passwordParam = pass
+authc.rememberMeParam = remember
+authc.successUrl = /simpleshirosecuredapplication/account/personalaccountpage.jsp
+[users]
+administrator=heslo,Administrator
+friendlyrepairman=heslo,repairman
+unfriendlyrepairman=heslo,repairman
+mathematician=heslo,scientist
+physicien=heslo,scientist
+productsales=heslo,sales
+servicessales=heslo,sales
+[roles]
+[urls]
+# enable autoc filter for the whole application
+/simpleshirosecuredapplication/**=authc
@@ -22,4 +22,21 @@
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
+ <!-- ==== Security ================================================================== -->
+
+ <filter>
+ <filter-name>ShiroFilter</filter-name>
+ <filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
+ <init-param>
+ <param-name>configPath</param-name>
+ <param-value>classpath:Shiro.ini</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>ShiroFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
</web-app>
@@ -3,6 +3,7 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<h2>Welcome</h2>
Simple web application for trying out Shiro security framework. There is no security yet. <br>
+<a href="<c:url value="/simpleshirosecuredapplication/account/login.jsp"/>">login</a><br>
<a href="<c:url value="/simpleshirosecuredapplication/account/allapplicationfunctions.jsp"/>">all application functions</a><br>
<a href="<c:url value="/simpleshirosecuredapplication/account/personalaccountpage.jsp"/>">personal account page</a><br>
<a href="<c:url value="/simpleshirosecuredapplication/adminarea/administratorspage.jsp"/>">administrators page</a><br>
@@ -0,0 +1,30 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Please Log In</title>
+</head>
+<body>
+<%@include file="/simpleshirosecuredapplication/common/commonformstuff.jsp" %>
+<form name="loginform" action="" method="post">
+ <table align="left" border="0" cellspacing="0" cellpadding="3">
+ <tr>
+ <td>Username:</td>
+ <td><input type="text" name="user" maxlength="30"></td>
+ </tr>
+ <tr>
+ <td>Password:</td>
+ <td><input type="password" name="pass" maxlength="30"></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="left"><input type="checkbox" name="remember"><font size="2">Remember Me</font></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="right"><input type="submit" name="submit" value="Login"></td>
+ </tr>
+ </table>
+</form>
+</body>
+</html>

0 comments on commit ec89bac

Please sign in to comment.