shiro web example I follow this,but in step 2,the stormpath is moved to another site okta,so i don`t what shall i do. There is an exception:
java.lang.IllegalStateException: Unable to load credentials from any provider in the chain.
So I write a reamls by myself.
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;
}
}
And in shiro.ini I change securityManager.realm = $stormpathRealm to securityManager.realm = realm.CustomSecurityRealm But exception is the same.Or sometimes no error when I delete it from tomcat and add again,but home page is not found --404. I hate this,i just want to see how to use shiro in web project,why it is so hard? I have no jndi,so I don`t copy from this example,I just want to make things simplest.How can I run the web sample?
Aucun commentaire:
Enregistrer un commentaire