Message = org.apache.shiro.authc.AuthenticationException:验证用户[admin]时出现SQL错误
我们无法在不同的计算机上运行正确的代码。发布有问题 开始工作
> Shiro.ini
> [main] jdbcRealm=org.apache.shiro.realm.jdbc.JdbcRealm
> jdbcRealm.authenticationQuery = SELECT password FROM users where
> username = ? jdbcRealm.userRolesQuery = select role from users where
> id=(select id FROM users where username =?)
ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
ds.serverName = localhost
ds.user = root
ds.password = root
ds.databaseName = marketdb
jdbcRealm.dataSource= $ds
> authc.loginUrl = /giris.html
> #authc.successUrl = /kasiyer/index.html user.loginUrl = /giris.html
[urls]
/giris.html = authc
/logout = logout
/admin/** = user, roles[admin]
/kasiyer/** = user, roles[kasiyer]
main.js
function girisYap() {
console.log('girisYap');
$.ajax({
type: 'POST',
contentType: 'application/json',
url: userURL,
dataType: "json",
data: formToJSON(),
success: function(data, textStatus, jqXHR){
if(data.sonuc=="admin"){
top.location.href = '/MarketOtomasyonu/admin/index.html';
}
else if(data.sonuc=="kasiyer"){
top.location.href = '/MarketOtomasyonu/kasiyer/index.html';
}
},
error: function(jqXHR, textStatus, errorThrown){
alert('girisYap: ' + textStatus);
}
});
}