本文整理了Java中org.apereo.cas.authentication.Authentication.getCredentials()
方法的一些代码示例,展示了Authentication.getCredentials()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Authentication.getCredentials()
方法的具体详情如下:
包路径:org.apereo.cas.authentication.Authentication
类名称:Authentication
方法名:getCredentials
暂无
代码示例来源:origin: org.apereo.cas/cas-server-core-authentication-api
@Override
public boolean isSatisfiedBy(final Authentication authn, final Set<AuthenticationHandler> authenticationHandlers) {
LOGGER.debug("Successful authentications: [{}], credentials: [{}]", authn.getSuccesses().keySet(), authn.getCredentials());
if (authn.getSuccesses().size() != authn.getCredentials().size()) {
LOGGER.warn("Number of successful authentications, [{}], does not match the number of provided credentials, [{}].",
authn.getSuccesses().size(), authn.getCredentials().size());
return false;
}
LOGGER.debug("Authentication policy is satisfied.");
return true;
}
}
代码示例来源:origin: org.apereo.cas/cas-server-core-authentication-mfa-api
/**
* Locate matching credential type boolean.
*
* @param authentication the authentication
* @param credentialClassType the credential class type
* @return the boolean
*/
protected boolean locateMatchingCredentialType(final Authentication authentication, final String credentialClassType) {
return StringUtils.isNotBlank(credentialClassType) && authentication.getCredentials()
.stream()
.anyMatch(e -> e.getCredentialClass().getName().matches(credentialClassType));
}
代码示例来源:origin: org.apereo.cas/cas-server-core-authentication-api
@Override
public boolean isSatisfiedBy(final Authentication authn, final Set<AuthenticationHandler> authenticationHandlers) throws Exception {
if (this.tryAll) {
val sum = authn.getSuccesses().size() + authn.getFailures().size();
if (authn.getCredentials().size() != sum) {
LOGGER.warn("Number of provided credentials [{}] does not match the sum of authentication successes and failures [{}]", authn.getCredentials().size(), sum);
return false;
}
LOGGER.debug("Authentication policy is satisfied with all authentication transactions");
return true;
}
if (!authn.getSuccesses().isEmpty()) {
LOGGER.debug("Authentication policy is satisfied having found at least one authentication transactions");
return true;
}
LOGGER.warn("Authentication policy has failed to find a successful authentication transaction");
return false;
}
}
代码示例来源:origin: org.apereo.cas/cas-server-core-authentication-api
val sum = authn.getSuccesses().size() + authn.getFailures().size();
if (this.tryAll) {
credsOk = authn.getCredentials().size() == sum;
+ "Successful authentication handlers are [{}]", authn.getCredentials().size(), sum, authn.getSuccesses().keySet());
return false;
代码示例来源:origin: org.apereo.cas/cas-server-core-authentication-api
private static void buildAuthenticationHistory(final Set<Authentication> authentications,
final Map<String, Object> authenticationAttributes,
final Map<String, Object> principalAttributes,
final AuthenticationBuilder authenticationBuilder) {
LOGGER.trace("Collecting authentication history based on [{}] authentication events", authentications.size());
authentications.forEach(authn -> {
val authenticatedPrincipal = authn.getPrincipal();
LOGGER.debug("Evaluating authentication principal [{}] for inclusion in result", authenticatedPrincipal);
principalAttributes.putAll(CoreAuthenticationUtils.mergeAttributes(principalAttributes, authenticatedPrincipal.getAttributes()));
LOGGER.debug("Collected principal attributes [{}] for inclusion in this result for principal [{}]",
principalAttributes, authenticatedPrincipal.getId());
authenticationAttributes.putAll(CoreAuthenticationUtils.mergeAttributes(authenticationAttributes, authn.getAttributes()));
LOGGER.debug("Finalized authentication attributes [{}] for inclusion in this authentication result", authenticationAttributes);
authenticationBuilder
.addSuccesses(authn.getSuccesses())
.addFailures(authn.getFailures())
.addCredentials(authn.getCredentials());
});
}
代码示例来源:origin: org.apereo.cas/cas-server-core-authentication-api
/**
* Creates a new builder initialized with data from the given authentication source.
*
* @param source Authentication source.
* @return New builder instance initialized with all fields in the given authentication source.
*/
public static AuthenticationBuilder newInstance(final Authentication source) {
val builder = new DefaultAuthenticationBuilder(source.getPrincipal());
builder.setAuthenticationDate(source.getAuthenticationDate());
builder.setCredentials(source.getCredentials());
builder.setSuccesses(source.getSuccesses());
builder.setFailures(source.getFailures());
builder.setAttributes(source.getAttributes());
return builder;
}
内容来源于网络,如有侵权,请联系作者删除!