org.openid4java.consumer.ConsumerManager Java Examples

The following examples show how to use org.openid4java.consumer.ConsumerManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: YadisResolverTest.java    From openid4java with Apache License 2.0 6 votes vote down vote up
public void testEmptyUri() throws Exception
{
    // empty string is a valid java.net.URI...

    YadisResult yadis = _resolver.discover("http://localhost:" + _servletPort + "/?headers=simplexrds&xrds=malformedxrds6",
        10, Collections.singleton("http://example.com/"));

    assertTrue("XRDS with an empty URI is valid; Yadis should have succeeded",
               yadis.getEndpoints().size() > 0);

    // also run through Discovery.extractDiscoveryInformation()
    ConsumerManager manager = new ConsumerManager();

    List results = manager.discover("http://localhost:" +
        _servletPort + "/?headers=simplexrds&xrds=malformedxrds6");

    assertEquals("No discovery information should have been returned for an empty URI",
                 0, results.size());

}
 
Example #2
Source File: ConsumerServlet.java    From openid4java with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void init(ServletConfig config) throws ServletException {
	super.init(config);

	context = config.getServletContext();

	LOG.debug("context: " + context);

	// --- Forward proxy setup (only if needed) ---
	ProxyProperties proxyProps = getProxyProperties(config);
	if (proxyProps != null) {
		LOG.debug("ProxyProperties: " + proxyProps);
		HttpClientFactory.setProxyProperties(proxyProps);
	}

	this.manager = new ConsumerManager();
	manager.setAssociations(new InMemoryConsumerAssociationStore());
	manager.setNonceVerifier(new InMemoryNonceVerifier(5000));
	manager.setMinAssocSessEnc(AssociationSessionType.DH_SHA256);
}
 
Example #3
Source File: OpenIDManager.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
private ConsumerManager getConsumerManagerInstance() throws SSOAgentException {

        HttpFetcherFactory httpFetcherFactory = null;
        try {
            httpFetcherFactory = new HttpFetcherFactory(SSLContext.getDefault(), null);
        } catch (NoSuchAlgorithmException e) {
            throw new SSOAgentException("Error while getting default SSL Context", e);
        }
        return new ConsumerManager(
                new RealmVerifierFactory(new YadisResolver(httpFetcherFactory)),
                new Discovery(), httpFetcherFactory);
    }
 
Example #4
Source File: OpenIdImpl.java    From socialauth with MIT License 5 votes vote down vote up
@Override
public void setAccessGrant(final AccessGrant accessGrant)
		throws AccessTokenExpireException {
	try {
		manager = new ConsumerManager();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
	discovered = null;
	this.accessGrant = accessGrant;
}
 
Example #5
Source File: IndexController.java    From openid4java with Apache License 2.0 4 votes vote down vote up
public void setConsumerManager(ConsumerManager consumerManager)
{
    this._consumerManager = consumerManager;
}
 
Example #6
Source File: PrepareRequestAttributesFilter.java    From openid4java with Apache License 2.0 4 votes vote down vote up
@Inject
public PrepareRequestAttributesFilter(ConsumerManager consumerManager) {
  this.consumerManager = consumerManager;
}
 
Example #7
Source File: SSOAgentDataHolder.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
public ConsumerManager getConsumerManager() {
    return consumerManager;
}
 
Example #8
Source File: SSOAgentDataHolder.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
public void setConsumerManager(ConsumerManager consumerManager) {
    this.consumerManager = consumerManager;
}
 
Example #9
Source File: OpenIdImpl.java    From socialauth with MIT License 4 votes vote down vote up
public OpenIdImpl(final Properties props) throws ConsumerException,
		Exception {
	manager = new ConsumerManager();
	discovered = null;
	this.id = props.getProperty("id");
}
 
Example #10
Source File: OpenIdImpl.java    From socialauth with MIT License 4 votes vote down vote up
public OpenIdImpl(final OAuthConfig config) throws ConsumerException,
		Exception {
	manager = new ConsumerManager();
	this.id = config.getId();
	discovered = null;
}