首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >shiro web step by step example不起作用,stormpath已移动

shiro web step by step example不起作用,stormpath已移动
EN

Stack Overflow用户
提问于 2018-02-17 11:37:54
回答 1查看 57关注 0票数 0

Shiro web example我遵循了这一点,但是在步骤2中,stormpath被移动到另一个站点okta,所以我不知道我应该做什么。有一个例外:

代码语言:javascript
复制
java.lang.IllegalStateException: Unable to load credentials from any provider in the chain.

所以我自己写了一个扩音器。

代码语言:javascript
复制
public class CustomSecurityRealm extends JdbcRealm{

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
        UsernamePasswordToken upToken = (UsernamePasswordToken) token;
        char[] psw = upToken.getPassword();
        String username = upToken.getUsername();
        return  new SimpleAuthenticationInfo(username, psw, getName());
    }

    @Override
    public void setDataSource(DataSource dataSource) {
        // TODO Auto-generated method stub
        DruidDataSource ds=new DruidDataSource();
        ds.setUrl("jdbc:mysql://localhost:3306/test2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&rewriteBatchedStatements=TRUE");
        ds.setUsername("root");
        ds.setPassword("root");
        dataSource=ds;
    }
}

在shiro.ini中,我将securityManager.realm = $stormpathRealm更改为securityManager.realm = realm.CustomSecurityRealm,但exception是相同的。或者,当我从tomcat中删除它并重新添加时,有时没有错误,但是没有找到主页--404。我讨厌这样,我只是想看看如何在网络项目中使用shiro,为什么它这么难?我没有jndi,所以我没有复制这个example,我只是想让事情变得简单。如何运行web示例?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-02-20 06:04:20

看一下https://github.com/apache/shiro/tree/master/samples中的示例

我们也会更新该教程。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48837649

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档