当前位置: 首页>>代码示例>>Java>>正文


Java CommonHelper.assertNotNull方法代码示例

本文整理汇总了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;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:24,代码来源:IndirectBasicAuthClient.java

示例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);
//            }
        }
    }
 
开发者ID:millross,项目名称:pac4j-async,代码行数:28,代码来源:Clients.java

示例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;
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:20,代码来源:IndirectClientV2.java

示例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();
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:21,代码来源:SAML2Client.java

示例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");
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:11,代码来源:SecretEncryptionConfiguration.java

示例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);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:RSASignatureConfiguration.java

示例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;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:DirectClientV2.java

示例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);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:15,代码来源:IpRegexpAuthenticator.java

示例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);
}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:13,代码来源:OAuthConfiguration.java

示例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);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:8,代码来源:TicketAndLogoutRequestExtractor.java

示例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());
}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:10,代码来源:DirectClient.java

示例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();
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:14,代码来源:OidcClient.java

示例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;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:HttpMethodMatcher.java

示例14: setEncryptionConfigurations

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
public void setEncryptionConfigurations(final List<EncryptionConfiguration> encryptionConfigurations) {
    CommonHelper.assertNotNull("encryptionConfigurations", encryptionConfigurations);
    this.encryptionConfigurations = encryptionConfigurations;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:5,代码来源:JwtAuthenticator.java

示例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);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:5,代码来源:Config.java


注:本文中的org.pac4j.core.util.CommonHelper.assertNotNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。