• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ConsumerManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ConsumerManager类属于org.openid4java.consumer包,在下文中一共展示了ConsumerManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: init

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
/**
 * {@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);
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:23,代码来源:ConsumerServlet.java


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


示例5: init

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
public void init(FilterConfig config) throws ServletException {
    super.init(config);
    try 
    {
        this.manager = new ConsumerManager();
    } catch (ConsumerException ex) {
        throw new ServletException(ex);
    }
    manager.setAssociations(new InMemoryConsumerAssociationStore());
    manager.setNonceVerifier(new InMemoryNonceVerifier(5000));
    manager.setMinAssocSessEnc(AssociationSessionType.DH_SHA256);
    manager.setImmediateAuth(true);
}
 
开发者ID:resteasy,项目名称:resteasy-examples,代码行数:14,代码来源:OpenIdFilter.java


示例6: OpenIdAuthenticator

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
/**
 * Creates a new instance of OpenIdAuthenticator.
 */
public OpenIdAuthenticator()
{
    try
    {
        m_oManager = new ConsumerManager();
    } 
    catch (ConsumerException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:16,代码来源:OpenIdAuthenticator.java


示例7: OpenIdServiceImpl

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
@Inject
OpenIdServiceImpl(
    DynamicItem<WebSession> cf,
    Provider<IdentifiedUser> iu,
    CanonicalWebUrl up,
    @GerritServerConfig Config config,
    AuthConfig ac,
    AccountManager am,
    ProxyProperties proxyProperties) {

  if (proxyProperties.getProxyUrl() != null) {
    final org.openid4java.util.ProxyProperties proxy = new org.openid4java.util.ProxyProperties();
    URL url = proxyProperties.getProxyUrl();
    proxy.setProxyHostName(url.getHost());
    proxy.setProxyPort(url.getPort());
    proxy.setUserName(proxyProperties.getUsername());
    proxy.setPassword(proxyProperties.getPassword());
    HttpClientFactory.setProxyProperties(proxy);
  }

  webSession = cf;
  identifiedUser = iu;
  urlProvider = up;
  accountManager = am;
  manager = new ConsumerManager();
  allowedOpenIDs = ac.getAllowedOpenIDs();
  openIdDomains = ac.getOpenIdDomains();
  papeMaxAuthAge =
      (int)
          ConfigUtil.getTimeUnit(
              config, //
              "auth",
              null,
              "maxOpenIdSessionAge",
              -1,
              TimeUnit.SECONDS);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:38,代码来源:OpenIdServiceImpl.java


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


示例9: getVerificationResult

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
/**
 * Gets verification result based on session and request parameters. This should be called when
 * processing the OpenId return request.
 * @param siteUrl the site URL
 * @param returnViewName the return view name
 *
 * @return the verification result
 * @throws DiscoveryException if discovery exception occurs.
 * @throws MessageException if message exception occurs.
 * @throws AssociationException if association exception occurs.
 */
public static VerificationResult getVerificationResult(final String siteUrl
        , final String returnViewName) throws MessageException, DiscoveryException,
        AssociationException {
    final ConsumerManager consumerManager = UI.getCurrent().getSession().getAttribute(ConsumerManager.class);
    final DiscoveryInformation discovered = UI.getCurrent().getSession().getAttribute(
            DiscoveryInformation.class);
    UI.getCurrent().getSession().setAttribute(ConsumerManager.class, null);
    UI.getCurrent().getSession().setAttribute(DiscoveryInformation.class, null);

    final HttpServletRequest request = ((VaadinServletRequest) VaadinService.getCurrentRequest())
            .getHttpServletRequest();

    final StringBuffer urlBuilder = new StringBuffer(siteUrl + returnViewName);
    final String queryString = request.getQueryString();
    if (queryString != null) {
        urlBuilder.append('?');
        urlBuilder.append(queryString);
    }
    final String requestUrl = urlBuilder.toString();

    final ParameterList openidResp = new ParameterList(request.getParameterMap());

    // verify the response
    return consumerManager.verify(requestUrl,
            openidResp, discovered);
}
 
开发者ID:bubblecloud,项目名称:ilves,代码行数:38,代码来源:OpenIdUtil.java


示例10: setAccessGrant

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
@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;
}
 
开发者ID:3pillarlabs,项目名称:socialauth,代码行数:12,代码来源:OpenIdImpl.java


示例11: internalInit

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
    CommonHelper.assertNotBlank("callbackUrl", this.callbackUrl);
    this.consumerManager = new ConsumerManager();
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:6,代码来源:BaseOpenIdClient.java


示例12: getConsumerManager

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
public ConsumerManager getConsumerManager() {
    return consumerManager;
}
 
开发者ID:wso2-extensions,项目名称:identity-agent-sso,代码行数:4,代码来源:SSOAgentDataHolder.java


示例13: setConsumerManager

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
public void setConsumerManager(ConsumerManager consumerManager) {
    this.consumerManager = consumerManager;
}
 
开发者ID:wso2-extensions,项目名称:identity-agent-sso,代码行数:4,代码来源:SSOAgentDataHolder.java


示例14: setConsumerManager

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
public void setConsumerManager(ConsumerManager consumerManager)
{
    this._consumerManager = consumerManager;
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:5,代码来源:IndexController.java


示例15: PrepareRequestAttributesFilter

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
@Inject
public PrepareRequestAttributesFilter(ConsumerManager consumerManager) {
  this.consumerManager = consumerManager;
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:5,代码来源:PrepareRequestAttributesFilter.java


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


示例17: OpenIdConsumer

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
public OpenIdConsumer(String returnToUrl) throws ConsumerException {
    this.manager = new ConsumerManager();
    this.returnToUrl = returnToUrl;
}
 
开发者ID:faramir,项目名称:ZawodyWeb,代码行数:5,代码来源:OpenIdConsumer.java


示例18: getConsumerManager

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
public static ConsumerManager getConsumerManager() {
	return INSTANCE;
}
 
开发者ID:aielo,项目名称:openid4java-rp-sample,代码行数:4,代码来源:ConsumerManagerProvider.java


示例19: ConsumerController

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
@Autowired
public ConsumerController(ConsumerManager manager) {
    this.manager = manager;
}
 
开发者ID:patka,项目名称:cognitor,代码行数:5,代码来源:ConsumerController.java


示例20: OpenIdImpl

import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
public OpenIdImpl(final Properties props) throws ConsumerException,
		Exception {
	manager = new ConsumerManager();
	discovered = null;
	this.id = props.getProperty("id");
}
 
开发者ID:3pillarlabs,项目名称:socialauth,代码行数:7,代码来源:OpenIdImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ICommonContentExtensionSite类代码示例发布时间:2022-05-21
下一篇:
Java RpcInvocation类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap