最近有点闲,就研究下公司的项目,用到了shiro然后就学了一下,在看公司项目的时候有些疑惑,前来社区发帖讨论学习,shiro.ini配置如下:
[main]
#Session
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
# Session Cache
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionManager.sessionDAO = $sessionDAO
securityManager.sessionManager = $sessionManager
sessionIdGenerator = me.zouooh.mvc.shiro.UU32SessionIdGenerator
securityManager.sessionManager.sessionDAO.sessionIdGenerator = $sessionIdGenerator
cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
cacheManager.cacheManagerConfigFile=classpath:ehcache.xml
securityManager.cacheManager = $cacheManager
sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
#user
user_realm = me.zouooh.mvc.shiro.UserRealm
user_realm.credentialsMatcher = $sha256Matcher
user_realm.cacheManager = $cacheManager
# cookie
sessionIdCookie=org.apache.shiro.web.servlet.SimpleCookie
sessionIdCookie.name=sid
sessionIdCookie.maxAge=43200000
sessionIdCookie.httpOnly=true
sessionManager.sessionIdCookie=$sessionIdCookie
sessionManager.sessionIdCookieEnabled=true
sessionManager.globalSessionTimeout=43200000
#mis
authc = com.yixin.xv.admin.mvc.AuthenticationFilter
authc.loginUrl = /login.html
authc.successUrl = /index.html
authc.usernameParam = account
logout.redirectUrl= /login.html
[urls]
/logout = logout
/druid/** = authc,roles[admin]
/burro/** = anon
/static/** = anon
/weixin/** = anon
/asset/** = anon
#/getServer = anon
/websocket = anon
/supplier/account/** = anon
/403.html = anon
/favicon.ico = anon
/captcha/** = anon
/** = authc
login.html:
<form class="form-signin" action="" method="post">
<div class="form-signin-heading text-center">
<h1 class="sign-title">${_siteName}后台登录</h1>
<img src="${base}/asset/images/login-logo.png" alt="" />
</div>
<div class="login-wrap">
<div style="height: 45px;border-bottom: 1px solid #eeeeee">
<img src="${base}/asset/images/user.png" alt="" style="width: 30px;float:left;margin-right: 1%;margin-top: 5px">
<input style="float: left;width: 84%;border: none;background: white;height: 30px;margin: 7.5px 0" name="account" type="text" class="" placeholder="用户名" autofocus
required>
</div>
<div style="height: 45px;border-bottom: 1px solid #eeeeee">
<img src="${base}/asset/images/lock.png" alt="" style="width: 30px;float:left;margin-right: 1%;margin-top: 5px;">
<input style="float: left;width: 84%;border: none;background: white;height: 30px;margin: 7.5px 0;" name="password" type="password" class=""
placeholder="密码" required >
</div>
<!-- <input name="captcha" type="text" value="">
<img id="captcha_img" onclick="next_captcha();return false;" src="${base}/captcha/next"></img> -->
<#if shiroLoginFailure??>
<div class="input-help">
<ul>
<li>${shiroLoginFailure}</li>
</ul>
</div>
</#if>
<button class="btn btn-lg btn-login btn-block" type="submit" style="font-size: 24px">
<!--<i class="fa fa-check"></i>-->
登录
</button>
</div>
</form>
开发者工具里看到了http请求地址是: localhost:8080/admin/login.html,也就是这个登录页面,但是却进入了realm的doGetAuthenticationInfo方法,很奇怪她是怎么进来的,希望社区的朋友能够解答下,十分感谢.