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


Java CommonHelper.getResource方法代码示例

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


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

示例1: testSaml2ConfigurationOfKeyStore

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Test
public void testSaml2ConfigurationOfKeyStore() throws Exception {
    final Resource rs = CommonHelper.getResource("testKeystore.jks");
    if (rs.exists() && !rs.getFile().delete()) {
        throw new TechnicalException("File could not be deleted");
    }

    final SAML2ClientConfiguration cfg =
            new SAML2ClientConfiguration("testKeystore.jks",
                    "pac4j-test-passwd",
                    "pac4j-test-passwd",
                    "resource:testshib-providers.xml");
    assertNotNull(cfg.getKeyStore());
    assertTrue(cfg.getKeyStore().size() == 1);
    if (!rs.getFile().delete()) {
        throw new TechnicalException("File could not be deleted");
    }

    final KeyStoreCredentialProvider p = new KeyStoreCredentialProvider(cfg);
    assertNotNull(p.getKeyInfoGenerator());
    assertNotNull(p.getCredentialResolver());
    assertNotNull(p.getKeyInfo());
    assertNotNull(p.getKeyInfoCredentialResolver());
    assertNotNull(p.getCredential());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:26,代码来源:SAML2ClientTests.java

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

示例3: SAML2IdentityProviderMetadataResolver

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
public SAML2IdentityProviderMetadataResolver(final Resource idpMetadataResource, final String idpMetadataPath,
		@Nullable final String idpEntityId) {
	CommonHelper.assertTrue(idpMetadataResource != null || CommonHelper.isNotBlank(idpMetadataPath),
			"Either IdpMetadataResource or idpMetadataPath must be provided");
	if (idpMetadataResource != null) {
		this.idpMetadataResource = idpMetadataResource;
	} else {
		this.idpMetadataResource = CommonHelper.getResource(idpMetadataPath);
	}
	this.idpEntityId = idpEntityId;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:12,代码来源:SAML2IdentityProviderMetadataResolver.java

示例4: SAML2ServiceProviderMetadataResolver

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
private SAML2ServiceProviderMetadataResolver(final String spMetadataPath,
                                             final WritableResource spMetadataResource,
                                             final String callbackUrl,
                                             @Nullable final String spEntityId,
                                             final boolean forceSpMetadataGeneration,
                                             final CredentialProvider credentialProvider,
                                             boolean authnRequestSigned, boolean wantsAssertionsSigned) {
    this.authnRequestSigned = authnRequestSigned;
    this.wantsAssertionsSigned = wantsAssertionsSigned;

    if (spMetadataResource != null) {
        this.spMetadataResource = spMetadataResource;
    } else {
        this.spMetadataResource = (WritableResource) CommonHelper.getResource(spMetadataPath);
    }
    this.spEntityId = spEntityId;
    this.credentialProvider = credentialProvider;
    this.callbackUrl = callbackUrl;
    this.forceSpMetadataGeneration = forceSpMetadataGeneration;

    // If the spEntityId is blank, use the callback url
    try {
        if (CommonHelper.isBlank(this.spEntityId)) {
            final URL url = new URL(callbackUrl);
            if (url.getQuery() != null) {
                this.spEntityId = url.toString().replace("?" + url.getQuery(), "");
            } else {
                this.spEntityId = url.toString();
            }
        }
        logger.info("Using SP entity ID {}", this.spEntityId);
    } catch (final Exception e) {
        throw new SAMLException(e);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:36,代码来源:SAML2ServiceProviderMetadataResolver.java

示例5: setIdentityProviderMetadataPath

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
public void setIdentityProviderMetadataPath(final String identityProviderMetadataPath) {
    this.identityProviderMetadataResource = CommonHelper.getResource(identityProviderMetadataPath);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:4,代码来源:SAML2ClientConfiguration.java

示例6: setKeystorePath

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
public void setKeystorePath(final String keystorePath) {
    this.keystoreResource = CommonHelper.getResource(keystorePath);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:4,代码来源:SAML2ClientConfiguration.java

示例7: setServiceProviderMetadataPath

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
public void setServiceProviderMetadataPath(final String serviceProviderMetadataPath) {
    this.serviceProviderMetadataResource = (WritableResource) CommonHelper.getResource(serviceProviderMetadataPath);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:4,代码来源:SAML2ClientConfiguration.java


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