本文整理了Java中fathom.realm.Account.getCredentials()
方法的一些代码示例,展示了Account.getCredentials()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Account.getCredentials()
方法的具体详情如下:
包路径:fathom.realm.Account
类名称:Account
方法名:getCredentials
暂无
代码示例来源:origin: gitblit/fathom
@Override
public Account authenticate(final String username, final String password) {
try (Connection conn = dataSource.getConnection()) {
Account account = getAccount(conn, username);
if (account == null) {
log.debug("No account found for '{}' in '{}'", username, getRealmName());
return null;
}
StandardCredentials storedCredentials = (StandardCredentials) account.getCredentials();
if (Strings.isNullOrEmpty(storedCredentials.getPassword())) {
log.debug("Account '{}' in '{}' has no password and may not be used for authentication",
account.getUsername(), getRealmName());
return null;
}
StandardCredentials requestCredentials = new StandardCredentials(username, password);
if (validatePassword(requestCredentials, storedCredentials)) {
log.debug("Authentication succeeded for '{}' against '{}'", username, getRealmName());
setAuthorizationsByQuery(conn, account);
cacheAccount(account);
return account;
} else {
log.debug("Authentication failed for '{}' against '{}'", username, getRealmName());
}
} catch (SQLException e) {
log.error("There was an SQL error while authenticating '{}'", username, e);
}
return null;
}
代码示例来源:origin: com.gitblit.fathom/fathom-security-jdbc
@Override
public Account authenticate(final String username, final String password) {
try (Connection conn = dataSource.getConnection()) {
Account account = getAccount(conn, username);
if (account == null) {
log.debug("No account found for '{}' in '{}'", username, getRealmName());
return null;
}
StandardCredentials storedCredentials = (StandardCredentials) account.getCredentials();
if (Strings.isNullOrEmpty(storedCredentials.getPassword())) {
log.debug("Account '{}' in '{}' has no password and may not be used for authentication",
account.getUsername(), getRealmName());
return null;
}
StandardCredentials requestCredentials = new StandardCredentials(username, password);
if (validatePassword(requestCredentials, storedCredentials)) {
log.debug("Authentication succeeded for '{}' against '{}'", username, getRealmName());
setAuthorizationsByQuery(conn, account);
cacheAccount(account);
return account;
} else {
log.debug("Authentication failed for '{}' against '{}'", username, getRealmName());
}
} catch (SQLException e) {
log.error("There was an SQL error while authenticating '{}'", username, e);
}
return null;
}
代码示例来源:origin: com.gitblit.fathom/fathom-security
public Account authenticate(StandardCredentials requestCredentials) {
if (hasAccount(requestCredentials.getUsername())) {
Account storedAccount = getAccount(requestCredentials.getUsername());
StandardCredentials storedCredentials = (StandardCredentials) storedAccount.getCredentials();
if (Strings.isNullOrEmpty(storedCredentials.getPassword())) {
log.debug("Account '{}' in '{}' has no password and may not be used for authentication",
storedAccount.getUsername(), getRealmName());
return null;
}
if (validatePassword(requestCredentials, storedCredentials)) {
log.debug("Authentication succeeded for '{}' against '{}'",
requestCredentials.getUsername(), getRealmName());
return storedAccount;
} else {
log.debug("Authentication failed for '{}' against '{}'",
requestCredentials.getUsername(), getRealmName());
}
} else {
log.debug("Unknown account '{}' in the '{}' realm", requestCredentials.getUsername(), getRealmName());
}
return null;
}
代码示例来源:origin: gitblit/fathom
public Account authenticate(StandardCredentials requestCredentials) {
if (hasAccount(requestCredentials.getUsername())) {
Account storedAccount = getAccount(requestCredentials.getUsername());
StandardCredentials storedCredentials = (StandardCredentials) storedAccount.getCredentials();
if (Strings.isNullOrEmpty(storedCredentials.getPassword())) {
log.debug("Account '{}' in '{}' has no password and may not be used for authentication",
storedAccount.getUsername(), getRealmName());
return null;
}
if (validatePassword(requestCredentials, storedCredentials)) {
log.debug("Authentication succeeded for '{}' against '{}'",
requestCredentials.getUsername(), getRealmName());
return storedAccount;
} else {
log.debug("Authentication failed for '{}' against '{}'",
requestCredentials.getUsername(), getRealmName());
}
} else {
log.debug("Unknown account '{}' in the '{}' realm", requestCredentials.getUsername(), getRealmName());
}
return null;
}
代码示例来源:origin: com.gitblit.fathom/fathom-security
if (account != null && !account.isDisabled()) {
authenticatedAccount = new Account(account.getName(), account.getCredentials().sanitize());
break;
代码示例来源:origin: gitblit/fathom
if (account != null && !account.isDisabled()) {
authenticatedAccount = new Account(account.getName(), account.getCredentials().sanitize());
break;
内容来源于网络,如有侵权,请联系作者删除!