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


Java CommonHelper.assertNotBlank方法代码示例

本文整理汇总了Java中org.pac4j.core.util.CommonHelper.assertNotBlank方法的典型用法代码示例。如果您正苦于以下问题:Java CommonHelper.assertNotBlank方法的具体用法?Java CommonHelper.assertNotBlank怎么用?Java CommonHelper.assertNotBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pac4j.core.util.CommonHelper的用法示例。


在下文中一共展示了CommonHelper.assertNotBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: internalInit

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(AsyncWebContext context) {

    CommonHelper.assertNotBlank("callbackUrl", this.callbackUrl,
            "set it up either on this client or the global Config");
    CommonHelper.assertNotNull("urlResolver", this.urlResolver);
    CommonHelper.assertNotNull("ajaxRequestResolver", this.ajaxRequestResolver);

    clientInit(context);

    // ensures components have been properly initialized
    CommonHelper.assertNotNull("redirectActionBuilder", this.redirectActionBuilder);
    CommonHelper.assertNotNull("credentialsExtractor", getCredentialsExtractor());
    CommonHelper.assertNotNull("authenticator", getAuthenticator());
    CommonHelper.assertNotNull("profileCreator", getProfileCreator());
    CommonHelper.assertNotNull("logoutActionBuilder", this.logoutActionBuilder);

}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:19,代码来源:AsyncIndirectClient.java

示例2: clientInit

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void clientInit(final AsyncWebContext context) {
    CommonHelper.assertNotBlank("fields", this.fields);
    configuration.setApi(FacebookApi.instance());
    configuration.setProfileDefinition(new FacebookProfileDefinition());
    configuration.setScope(scope);
    configuration.setHasBeenCancelledFactory(ctx -> {
        final String error = ctx.getRequestParameter(OAuthCredentialsException.ERROR);
        final String errorReason = ctx.getRequestParameter(OAuthCredentialsException.ERROR_REASON);
        // user has denied permissions
        if ("access_denied".equals(error) && "user_denied".equals(errorReason)) {
            return true;
        } else {
            return false;
        }
    });
    configuration.setWithState(true);
    setConfiguration(configuration);
    defaultProfileCreator(new AsyncFacebookProfileCreator(configuration));

    super.clientInit(context);
}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:23,代码来源:AsyncFacebookClient.java

示例3: internalInit

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
    CommonHelper.assertNotBlank("accessId", accessId);
    CommonHelper.assertNotBlank("secretKey", secretKey);
    CommonHelper.assertNotBlank("applicationId", applicationId);

    try {
        final Client client = new Client(new DefaultApiKey(accessId, secretKey));
        this.application = client.getDataStore().getResource(
                String.format("/applications/%s", applicationId), Application.class);
    } catch (final Exception e) {
        throw new BadCredentialsException("An exception is caught trying to access Stormpath cloud. " +
                "Please verify that your provided Stormpath <accessId>, " +
                "<secretKey>, and <applicationId> are correct. Original Stormpath error: " + e.getMessage());
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:StormpathAuthenticator.java

示例4: isAuthorized

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
public Boolean isAuthorized(WebContext context, List<CommonProfile> profiles) throws HttpAction {

    CommonHelper.assertNotBlank("allowOrigin", allowOrigin);

    context.setResponseHeader(HttpConstants.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, allowOrigin);

    if (CommonHelper.isNotBlank(exposeHeaders)) {
        context.setResponseHeader(HttpConstants.ACCESS_CONTROL_EXPOSE_HEADERS_HEADER, exposeHeaders);
    }

    if (maxAge != -1) {
        context.setResponseHeader(HttpConstants.ACCESS_CONTROL_MAX_AGE_HEADER, "" + maxAge);
    }

    if (allowCredentials != null) {
        context.setResponseHeader(HttpConstants.ACCESS_CONTROL_ALLOW_CREDENTIALS_HEADER, allowCredentials.toString());
    }

    if (allowMethods != null) {
        final String methods = allowMethods.stream().map(m -> m.toString()).collect(Collectors.joining(", "));
        context.setResponseHeader(HttpConstants.ACCESS_CONTROL_ALLOW_METHODS_HEADER, methods);
    }

    if (CommonHelper.isNotBlank(allowHeaders)) {
        context.setResponseHeader(HttpConstants.ACCESS_CONTROL_ALLOW_HEADERS_HEADER, allowHeaders);
    }

    return true;
}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:31,代码来源:CorsAuthorizer.java

示例5: findClient

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
/**
 * Return the right client according to the web context.
 *
 * @param context web context
 * @return the right client
 */
public T findClient(final WebContext<?> context) {
    init();
    final String name = context.getRequestParameter(this.clientNameParameter);
    if (name == null && defaultClient != null) {
        return defaultClient;
    }
    CommonHelper.assertNotBlank("name", name);
    return findClient(name);
}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:16,代码来源:Clients.java

示例6: retrieveRedirectAction

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
protected RedirectAction retrieveRedirectAction(final WebContext context) throws HttpAction {
    final String userIdentifier = getUser(context);
    CommonHelper.assertNotBlank("openIdUser", userIdentifier);

    try {
        // perform discovery on the user-supplied identifier
        final List discoveries = this.consumerManager.discover(userIdentifier);

        // attempt to associate with the OpenID provider
        // and retrieve one service endpoint for authentication
        final DiscoveryInformation discoveryInformation = this.consumerManager.associate(discoveries);

        // save discovery information in session
        context.setSessionAttribute(getDiscoveryInformationSessionAttributeName(), discoveryInformation);

        // create authentication request to be sent to the OpenID provider
        final AuthRequest authRequest = this.consumerManager.authenticate(discoveryInformation,
                computeFinalCallbackUrl(context));

        // create fetch request for attributes
        final FetchRequest fetchRequest = getFetchRequest();
        if (fetchRequest != null) {
            authRequest.addExtension(fetchRequest);
        }

        final String redirectionUrl = authRequest.getDestinationUrl(true);
        logger.debug("redirectionUrl: {}", redirectionUrl);
        return RedirectAction.redirect(redirectionUrl);
    } catch (final OpenIDException e) {
        throw new TechnicalException("OpenID exception", e);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:35,代码来源:BaseOpenIdClient.java

示例7: internalInit

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
    CommonHelper.assertNotBlank("authEndpoint", this.authUrl);
    CommonHelper.assertNotBlank("tokenEndpoint", this.tokenUrl);
    CommonHelper.assertNotBlank("profileEndpoint", this.profileUrl);
    super.internalInit(context);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:8,代码来源:GenericOAuth20StateClient.java

示例8: internalInit

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
    CommonHelper.assertNotNull("configuration", configuration);
    CommonHelper.assertNotBlank("callbackUrl", callbackUrl);

    configuration.init(context);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:8,代码来源:CasAuthenticator.java

示例9: isAuthorized

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
public boolean isAuthorized(WebContext context, List<CommonProfile> profiles) throws HttpAction {
    CommonHelper.assertNotBlank("allowOrigin", allowOrigin);

    context.setResponseHeader(HttpConstants.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, allowOrigin);

    if (CommonHelper.isNotBlank(exposeHeaders)) {
        context.setResponseHeader(HttpConstants.ACCESS_CONTROL_EXPOSE_HEADERS_HEADER, exposeHeaders);
    }

    if (maxAge != -1) {
        context.setResponseHeader(HttpConstants.ACCESS_CONTROL_MAX_AGE_HEADER, "" + maxAge);
    }

    if (allowCredentials != null) {
        context.setResponseHeader(HttpConstants.ACCESS_CONTROL_ALLOW_CREDENTIALS_HEADER, allowCredentials.toString());
    }

    if (allowMethods != null) {
        final String methods = allowMethods.stream().map(m -> m.toString()).collect(Collectors.joining(", "));
        context.setResponseHeader(HttpConstants.ACCESS_CONTROL_ALLOW_METHODS_HEADER, methods);
    }

    if (CommonHelper.isNotBlank(allowHeaders)) {
        context.setResponseHeader(HttpConstants.ACCESS_CONTROL_ALLOW_HEADERS_HEADER, allowHeaders);
    }

    return true;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:30,代码来源:CorsAuthorizer.java

示例10: internalInit

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
    CommonHelper.assertNotBlank("headerName", this.headerName);
    CommonHelper.assertNotNull("prefixHeader", this.prefixHeader);

    setCredentialsExtractor(new BasicAuthExtractor(this.headerName, this.prefixHeader, getName()));
    if (CommonHelper.isNotBlank(this.casServerPrefixUrl)) {
        setAuthenticator(new CasRestAuthenticator(this.casServerPrefixUrl));
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:11,代码来源:CasRestBasicAuthClient.java

示例11: buildRSAKeyPairFromJwk

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
/**
 * Build the RSA key pair from the JWK JSON.
 *
 * @param json the json
 * @return the key pair
 */
public static KeyPair buildRSAKeyPairFromJwk(final String json) {
    CommonHelper.assertNotBlank("json", json);

    try {
        final RSAKey rsaKey = RSAKey.parse(json);
        return rsaKey.toKeyPair();
    } catch (final JOSEException | ParseException e) {
        throw new TechnicalException(e);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:JWKHelper.java

示例12: 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

示例13: internalInit

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
    CommonHelper.assertNotBlank("headerName", this.headerName);
    CommonHelper.assertNotNull("prefixHeader", this.prefixHeader);

    setCredentialsExtractor(new HeaderExtractor(this.headerName, this.prefixHeader, getName()));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:8,代码来源:HeaderClient.java

示例14: SAML2ClientConfiguration

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
private SAML2ClientConfiguration(final KeyStore keyStore, final String keyStoreAlias, final String keyStoreType,
                                 final Resource keystoreResource, final String keystorePath, final String keystorePassword,
                                 final String privateKeyPassword, final Resource identityProviderMetadataResource,
                                 final String identityProviderMetadataPath,
                                 final String identityProviderEntityId, final String serviceProviderEntityId) {
    this.keyStore = keyStore;
    this.keyStoreAlias = keyStoreAlias;
    this.keyStoreType = keyStoreType;
    this.keystoreResource = keystoreResource;
    if (this.keystoreResource == null) {
        this.keystoreResource = CommonHelper.getResource(keystorePath);
    }
    this.keystorePassword = keystorePassword;
    this.privateKeyPassword = privateKeyPassword;

    if (this.keystoreResource == null || !this.keystoreResource.exists()) {
        LOGGER.warn("Provided path to keystore does not exist. Creating one at {}", keystorePath);
        createKeystore();
    }
    this.identityProviderMetadataResource = identityProviderMetadataResource;
    if (this.identityProviderMetadataResource == null) {
        this.identityProviderMetadataResource = CommonHelper.getResource(identityProviderMetadataPath);
    }
    this.identityProviderEntityId = identityProviderEntityId;
    this.serviceProviderEntityId = serviceProviderEntityId;

    CommonHelper.assertNotBlank("keystorePassword", this.keystorePassword);
    CommonHelper.assertNotBlank("privateKeyPassword", this.privateKeyPassword);
    CommonHelper.assertTrue(
            this.identityProviderMetadataResource != null || CommonHelper.isNotBlank(identityProviderMetadataPath),
            "Either identityProviderMetadataResource or identityProviderMetadataPath must be provided");

    final BasicSignatureSigningConfiguration config = DefaultSecurityConfigurationBootstrap.buildDefaultSignatureSigningConfiguration();
    this.blackListedSignatureSigningAlgorithms = new ArrayList<>(config.getBlacklistedAlgorithms());
    this.signatureAlgorithms = new ArrayList<>(config.getSignatureAlgorithms());
    this.signatureReferenceDigestMethods = new ArrayList<>(config.getSignatureReferenceDigestMethods());
    this.signatureReferenceDigestMethods.remove("http://www.w3.org/2001/04/xmlenc#sha512");
    this.signatureCanonicalizationAlgorithm = config.getSignatureCanonicalizationAlgorithm();

}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:41,代码来源:SAML2ClientConfiguration.java

示例15: internalInit

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
    super.internalInit(context);

    CommonHelper.assertNotBlank("loginUrl", this.loginUrl);
    this.loginUrl = callbackUrlResolver.compute(this.loginUrl, context);
    CommonHelper.assertNotBlank("usernameParameter", this.usernameParameter);
    CommonHelper.assertNotBlank("passwordParameter", this.passwordParameter);

    setRedirectActionBuilder(webContext -> RedirectAction.redirect(this.loginUrl));
    setCredentialsExtractor(new FormExtractor(usernameParameter, passwordParameter, getName()));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:FormClient.java


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