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


Java ConsumerManager.discover方法代码示例

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


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

示例1: reconnectToMxID

import org.openid4java.consumer.ConsumerManager; //导入方法依赖的package包/类
private void reconnectToMxID() {
	LOG.info("Starting OpenId handler ... OpenIDReturnURL = " + OPENID_RETURN_URL + "; OpenIdProvider: " + OPENID_PROVIDER);
	try {

		manager = new ConsumerManager();
		manager.setAssociations(new InMemoryConsumerAssociationStore());
		manager.setNonceVerifier(new InMemoryNonceVerifier(5000));
		manager.setMinAssocSessEnc(AssociationSessionType.DH_SHA256);
		manager.getRealmVerifier().setEnforceRpId(true);

		discoveries = manager.discover(OPENID_PROVIDER);
		discovered = manager.associate(discoveries);

		started = true;
		LOG.info("Starting OpenId handler ... DONE");

	} catch (DiscoveryException e) {
		LOG.error("Failed to discover OpenId service: " + e.getMessage(), e);
	}
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:21,代码来源:OpenIDHandler.java

示例2: testEmptyUri

import org.openid4java.consumer.ConsumerManager; //导入方法依赖的package包/类
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());

}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:21,代码来源:YadisResolverTest.java

示例3: reconnectToMxID

import org.openid4java.consumer.ConsumerManager; //导入方法依赖的package包/类
private void reconnectToMxID() {
	log.info("Starting OpenId handler ... OpenIDReturnURL = " + OpenIDReturnURL + "; OpenIdProvider: " + OPENID_PROVIDER);
	try {

		manager = new ConsumerManager();
		manager.setAssociations(new InMemoryConsumerAssociationStore());
		manager.setNonceVerifier(new InMemoryNonceVerifier(5000));
		manager.setMinAssocSessEnc(AssociationSessionType.DH_SHA256);
		manager.getRealmVerifier().setEnforceRpId(true);

		discoveries = manager.discover(OPENID_PROVIDER);
		discovered = manager.associate(discoveries);

		started = true;
		log.info("Starting OpenId handler ... DONE");

	} catch (Exception e) {
		log.error("Failed to discover OpenId service: " + e.getMessage(), e);
	}
}
 
开发者ID:mendix,项目名称:EmailModuleWithTemplates,代码行数:21,代码来源:OpenIDHandler.java

示例4: prepareAuthenticationUrl

import org.openid4java.consumer.ConsumerManager; //导入方法依赖的package包/类
/**
 * Prepares open ID authentication URL.
 *
 * @param openIdIdentifier the open ID identifier to authenticate
 * @param siteUrl the site URL
 * @param returnViewName the return view name
 * @return the authentication URL
 * @throws DiscoveryException if discovery exception occurs.
 * @throws MessageException if message exception occurs.
 * @throws ConsumerException if consume exception occurs.
 */
public static String prepareAuthenticationUrl(final String openIdIdentifier, final String siteUrl
        , final String returnViewName)
        throws DiscoveryException, MessageException, ConsumerException {
    if (UI.getCurrent().getSession().getAttribute(ConsumerManager.class) == null) {
        UI.getCurrent().getSession().setAttribute(ConsumerManager.class, new ConsumerManager());
    }
    final ConsumerManager manager = UI.getCurrent().getSession().getAttribute(ConsumerManager.class);
    final String returnURL = siteUrl + returnViewName;
    final List discoveries = manager.discover(openIdIdentifier);
    final DiscoveryInformation discovered = manager.associate(discoveries);
    UI.getCurrent().getSession().setAttribute(DiscoveryInformation.class, discovered);
    final AuthRequest authReq = manager.authenticate(discovered, returnURL);
    return authReq.getDestinationUrl(true);
}
 
开发者ID:bubblecloud,项目名称:ilves,代码行数:26,代码来源:OpenIdUtil.java

示例5: showOpenIDForm

import org.openid4java.consumer.ConsumerManager; //导入方法依赖的package包/类
public Resolution showOpenIDForm()
        throws ConsumerException, MessageException, DiscoveryException, MalformedURLException {
    ConsumerManager manager = new ConsumerManager();

    // perform discovery on the user-supplied identifier
    List discoveries = manager.discover(openIdUrl);

    // attempt to associate with the OpenID provider
    // and retrieve one service endpoint for authentication
    DiscoveryInformation discovered = manager.associate(discoveries);

    UrlBuilder urlBuilder = new UrlBuilder(context.getLocale(), context.getActionPath(), false);
    urlBuilder.setEvent("handleOpenIDLogin");
    urlBuilder.addParameter("returnUrl", returnUrl);
    urlBuilder.addParameter("cancelReturnUrl", cancelReturnUrl);

    URL url = new URL(context.getRequest().getRequestURL().toString());
    String port = url.getPort() > 0 ? ":" + url.getPort() : "";
    String baseUrl = url.getProtocol() + "://" + url.getHost() + port;
    String urlString = baseUrl + context.getRequest().getContextPath() + urlBuilder;
    // obtain a AuthRequest message to be sent to the OpenID provider
    AuthRequest authReq = manager.authenticate(discovered, urlString, baseUrl);

    // store the discovery information in the user's session for later use
    // leave out for stateless operation / if there is no session
    HttpSession session = context.getRequest().getSession();
    session.setAttribute(OPENID_DISCOVERED, discovered);
    session.setAttribute(OPENID_CONSUMER_MANAGER, manager);

    String destinationUrl = authReq.getDestinationUrl(true);

    if(destinationUrl.length() > 2000) {
        if(authReq.isVersion2()) {
            openIdDestinationUrl = authReq.getDestinationUrl(false);
            openIdParameterMap = authReq.getParameterMap();
            return new ForwardResolution("/m/openid/pageactions/openid/openIDFormRedirect.jsp");
        } else {
            SessionMessages.addErrorMessage("Cannot login, payload too big and OpenID version 2 not supported.");
            return new ForwardResolution(getLoginPage());
        }
    } else {
        return new RedirectResolution(destinationUrl, false);
    }
}
 
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:45,代码来源:OpenIdLoginAction.java


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