本文整理汇总了Java中org.pac4j.core.util.InitializableWebObject类的典型用法代码示例。如果您正苦于以下问题:Java InitializableWebObject类的具体用法?Java InitializableWebObject怎么用?Java InitializableWebObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InitializableWebObject类属于org.pac4j.core.util包,在下文中一共展示了InitializableWebObject类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doAuthentication
import org.pac4j.core.util.InitializableWebObject; //导入依赖的package包/类
@Override
protected HandlerResult doAuthentication(final Credential credential) throws GeneralSecurityException, PreventedException {
CommonHelper.assertNotNull("profileCreator", this.profileCreator);
final C credentials = convertToPac4jCredentials((I) credential);
LOGGER.debug("credentials: [{}]", credentials);
try {
final Authenticator authenticator = getAuthenticator(credential);
if (authenticator instanceof InitializableObject) {
((InitializableObject) authenticator).init();
}
if (authenticator instanceof InitializableWebObject) {
((InitializableWebObject) authenticator).init(getWebContext());
}
CommonHelper.assertNotNull("authenticator", authenticator);
authenticator.validate(credentials, getWebContext());
final UserProfile profile = this.profileCreator.create(credentials, getWebContext());
LOGGER.debug("profile: [{}]", profile);
return createResult(new ClientCredential(credentials), profile);
} catch (final Exception e) {
LOGGER.error("Failed to validate credentials", e);
throw new FailedLoginException("Failed to validate credentials: " + e.getMessage());
}
}
示例2: internalInit
import org.pac4j.core.util.InitializableWebObject; //导入依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
CommonHelper.assertNotNull("delegate", this.delegate);
CommonHelper.assertTrue(cacheSize > 0, "cacheSize must be > 0");
CommonHelper.assertTrue(timeout > 0, "timeout must be > 0");
CommonHelper.assertNotNull("timeUnit", this.timeUnit);
if (delegate instanceof InitializableWebObject) {
((InitializableWebObject) delegate).init(context);
}
this.cache = CacheBuilder.newBuilder().maximumSize(cacheSize)
.expireAfterWrite(timeout, timeUnit).build();
}