Apache Shiro credentials based security for Rest service

扶醉桌前 提交于 2019-12-03 08:55:20

You could use basic auth for your webservice endpoints and form based authentication for the web.

Do web users also have access to your webservice?

EDIT:

Checkout this sample app. https://github.com/dominicfarr/skybird-shiro

It has three url paths configured in shiro.

web - uses form authentication.

api - uses basic authentication.

jersey - anonymous access.

Cutting to the shiro.ini config.

[main]
authc.loginUrl = /web/login.html

sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO

securityManager.sessionManager = $sessionManager
securityManager.sessionManager.sessionDAO = $sessionDAO


[users]
dom = password, user

[roles]
user = standard

[urls]
/web/login.html = authc
/web/** = authc
/api/** = authcBasic
/jersey/message = anon
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!