本文整理汇总了Java中org.pac4j.core.util.CommonHelper.assertNotNull方法的典型用法代码示例。如果您正苦于以下问题:Java CommonHelper.assertNotNull方法的具体用法?Java CommonHelper.assertNotNull怎么用?Java CommonHelper.assertNotNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pac4j.core.util.CommonHelper
的用法示例。
在下文中一共展示了CommonHelper.assertNotNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveCredentials
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected UsernamePasswordCredentials retrieveCredentials(final WebContext context) throws HttpAction {
CommonHelper.assertNotNull("credentialsExtractor", getCredentialsExtractor());
CommonHelper.assertNotNull("authenticator", getAuthenticator());
final UsernamePasswordCredentials credentials;
try {
// retrieve credentials
credentials = getCredentialsExtractor().extract(context);
logger.debug("credentials : {}", credentials);
if (credentials == null) {
throw HttpAction.unauthorized("Requires authentication", context, this.realmName, null);
}
// validate credentials
getAuthenticator().validate(credentials, context);
} catch (final CredentialsException e) {
throw HttpAction.unauthorized("Requires authentication", context, this.realmName, null);
}
return credentials;
}
示例2: internalInit
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
/**
* Initialize all clients by computing callback urls if necessary.
*/
@Override
protected void internalInit() {
CommonHelper.assertNotNull("clients", getClients());
final HashSet<String> names = new HashSet<>();
for (final T client : getClients()) {
final String name = client.getName();
final String lowerName = name.toLowerCase();
if (names.contains(lowerName)) {
throw new TechnicalException("Duplicate name in clients: " + name);
}
names.add(lowerName);
// Instead of using brittle client type checking, make it the responsibility of the client to know how
// to configure itself from the Clients object
client.configureFromClientsObject(this);
// if (client instanceof IndirectClient) {
// updateCallbackUrlOfIndirectClient((IndirectClient) client);
// }
// final BaseClient baseClient = (BaseClient) client;
// if (!authorizationGenerators.isEmpty()) {
// baseClient.addAuthorizationGenerators(this.authorizationGenerators);
// }
}
}
示例3: retrieveCredentials
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected C retrieveCredentials(final WebContext context) throws HttpAction {
CommonHelper.assertNotNull("credentialsExtractor", this.credentialsExtractor);
CommonHelper.assertNotNull("authenticator", this.authenticator);
try {
final C credentials = this.credentialsExtractor.extract(context);
if (credentials == null) {
return null;
}
this.authenticator.validate(credentials, context);
return credentials;
} catch (CredentialsException e) {
logger.info("Failed to retrieve or validate credentials: {}", e.getMessage());
logger.debug("Failed to retrieve or validate credentials", e);
return null;
}
}
示例4: internalInit
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
CommonHelper.assertNotBlank("callbackUrl", this.callbackUrl);
CommonHelper.assertNotNull("configuration", this.configuration);
// First of all, initialize the configuration. It may dynamically load some properties, if it is not a static one.
this.configuration.init(getName(), context);
initCredentialProvider();
initDecrypter();
initSignatureSigningParametersProvider();
final MetadataResolver metadataManager = initChainingMetadataResolver(
initIdentityProviderMetadataResolver(),
initServiceProviderMetadataResolver(context));
initSAMLContextProvider(metadataManager);
initSAMLObjectBuilder();
initSignatureTrustEngineProvider(metadataManager);
initSAMLResponseValidator();
initSAMLProfileHandler();
}
示例5: internalInit
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit() {
CommonHelper.assertNotBlank("secret", secret);
CommonHelper.assertNotNull("algorithm", algorithm);
CommonHelper.assertNotNull("method", method);
if (!supports(this.algorithm, this.method)) {
throw new TechnicalException("Only the direct and AES algorithms are supported with the appropriate encryption method");
}
}
示例6: verify
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
public boolean verify(final SignedJWT jwt) throws JOSEException {
init();
CommonHelper.assertNotNull("publicKey", publicKey);
final JWSVerifier verifier = new RSASSAVerifier(this.publicKey);
return jwt.verify(verifier);
}
示例7: retrieveUserProfile
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected U retrieveUserProfile(final C credentials, final WebContext context) throws HttpAction {
CommonHelper.assertNotNull("profileCreator", this.profileCreator);
final U profile = this.profileCreator.create(credentials, context);
logger.debug("profile: {}", profile);
return profile;
}
示例8: validate
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
public void validate(final TokenCredentials credentials, final WebContext context) throws HttpAction {
CommonHelper.assertNotNull("pattern", pattern);
final String ip = credentials.getToken();
if (!this.pattern.matcher(ip).matches()) {
throw new CredentialsException("Unauthorized IP address: " + ip);
}
final IpProfile profile = new IpProfile(ip);
logger.debug("profile: {}", profile);
credentials.setUserProfile(profile);
}
示例9: internalInit
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext<?> context) {
CommonHelper.assertNotNull("urlResolver", this.urlResolver);
CommonHelper.assertNotNull("callbackUrl", this.callbackUrl);
CommonHelper.assertNotBlank("key", this.key);
CommonHelper.assertNotBlank("secret", this.secret);
CommonHelper.assertNotNull("api", api);
CommonHelper.assertNotNull("hasBeenCancelledFactory", hasBeenCancelledFactory);
CommonHelper.assertNotNull("profileDefinition", profileDefinition);
this.service = buildService(context, null);
}
示例10: internalInit
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
CommonHelper.assertNotNull("configuration", configuration);
CommonHelper.assertNotBlank("clientName", clientName);
configuration.init(context);
}
示例11: internalInit
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WC context) {
clientInit(context);
// ensures components have been properly initialized
CommonHelper.assertNotNull("credentialsExtractor", getCredentialsExtractor());
CommonHelper.assertNotNull("authenticator", getAuthenticator());
CommonHelper.assertNotNull("profileCreator", getProfileCreator());
}
示例12: internalInit
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
super.internalInit(context);
CommonHelper.assertNotNull("configuration", configuration);
configuration.setCallbackUrl(computeFinalCallbackUrl(context));
configuration.init(context);
setRedirectActionBuilder(new OidcRedirectActionBuilder(configuration));
setCredentialsExtractor(new OidcExtractor(configuration, getName()));
setAuthenticator(new OidcAuthenticator(configuration));
createProfileCreator();
}
示例13: matches
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
public boolean matches(final WebContext context) throws HttpAction {
CommonHelper.assertNotNull("methods", methods);
final String requestMethod = context.getRequestMethod();
for (final HTTP_METHOD method : methods) {
if (method.name().equalsIgnoreCase(requestMethod)) {
return true;
}
}
return false;
}
示例14: setEncryptionConfigurations
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
public void setEncryptionConfigurations(final List<EncryptionConfiguration> encryptionConfigurations) {
CommonHelper.assertNotNull("encryptionConfigurations", encryptionConfigurations);
this.encryptionConfigurations = encryptionConfigurations;
}
示例15: setMatcher
import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
public void setMatcher(final Matcher matcher) {
CommonHelper.assertNotNull("matcher", matcher);
this.matchers.put(matcher.getClass().getSimpleName(), matcher);
}