本文整理汇总了Java中org.openid4java.consumer.ConsumerManager类的典型用法代码示例。如果您正苦于以下问题:Java ConsumerManager类的具体用法?Java ConsumerManager怎么用?Java ConsumerManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConsumerManager类属于org.openid4java.consumer包,在下文中一共展示了ConsumerManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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());
}
示例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);
}
示例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);
}
}
示例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);
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例11: internalInit
import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
CommonHelper.assertNotBlank("callbackUrl", this.callbackUrl);
this.consumerManager = new ConsumerManager();
}
示例12: getConsumerManager
import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
public ConsumerManager getConsumerManager() {
return consumerManager;
}
示例13: setConsumerManager
import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
public void setConsumerManager(ConsumerManager consumerManager) {
this.consumerManager = consumerManager;
}
示例14: setConsumerManager
import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
public void setConsumerManager(ConsumerManager consumerManager)
{
this._consumerManager = consumerManager;
}
示例15: PrepareRequestAttributesFilter
import org.openid4java.consumer.ConsumerManager; //导入依赖的package包/类
@Inject
public PrepareRequestAttributesFilter(ConsumerManager consumerManager) {
this.consumerManager = consumerManager;
}