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

Java SessionIndex类代码示例

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

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



SessionIndex类属于org.opensaml.saml2.core包,在下文中一共展示了SessionIndex类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processChildElement

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    LogoutRequest req = (LogoutRequest) parentSAMLObject;

    if (childSAMLObject instanceof BaseID) {
        req.setBaseID((BaseID) childSAMLObject);
    } else if (childSAMLObject instanceof NameID) {
        req.setNameID((NameID) childSAMLObject);
    } else if (childSAMLObject instanceof EncryptedID) {
        req.setEncryptedID((EncryptedID) childSAMLObject);
    } else if (childSAMLObject instanceof SessionIndex) {
        req.getSessionIndexes().add((SessionIndex) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:LogoutRequestUnmarshaller.java


示例2: handleSingleLogoutRequest

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/**
 * This method is used to handle the single logout requests sent by the Identity Provider
 *
 * @param req  Corresponding HttpServletRequest
 * @param resp Corresponding HttpServletResponse
 */
private void handleSingleLogoutRequest(HttpServletRequest req, HttpServletResponse resp) {
    String logoutReqStr = req.getParameter(SAML2SSOAuthenticatorConstants.HTTP_POST_PARAM_SAML2_AUTH_REQ);

    XMLObject samlObject = null;

    try {
        samlObject = Util.unmarshall(Util.decode(logoutReqStr));
    } catch (SAML2SSOUIAuthenticatorException e) {
        log.error("Error handling the single logout request", e);
    }

    if (samlObject instanceof LogoutRequest) {
        LogoutRequest logoutRequest = (LogoutRequest) samlObject;
        //  There can be only one session index entry.
        List<SessionIndex> sessionIndexList = logoutRequest.getSessionIndexes();
        if (sessionIndexList.size() > 0) {
            SSOSessionManager.getInstance().handleLogout(
                    sessionIndexList.get(0).getSessionIndex());
        }
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:28,代码来源:SSOAssertionConsumerService.java


示例3: buildLogoutRequest

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
protected LogoutRequest buildLogoutRequest(String user, String sessionIdx) throws SSOAgentException {

        LogoutRequest logoutReq = new LogoutRequestBuilder().buildObject();

        logoutReq.setID(SSOAgentUtils.createID());
        logoutReq.setDestination(ssoAgentConfig.getSAML2().getIdPURL());

        DateTime issueInstant = new DateTime();
        logoutReq.setIssueInstant(issueInstant);
        logoutReq.setNotOnOrAfter(new DateTime(issueInstant.getMillis() + 5 * 60 * 1000));

        IssuerBuilder issuerBuilder = new IssuerBuilder();
        Issuer issuer = issuerBuilder.buildObject();
        issuer.setValue(ssoAgentConfig.getSAML2().getSPEntityId());
        logoutReq.setIssuer(issuer);

        NameID nameId = new NameIDBuilder().buildObject();
        nameId.setFormat("urn:oasis:names:tc:SAML:2.0:nameid-format:entity");
        nameId.setValue(user);
        logoutReq.setNameID(nameId);

        SessionIndex sessionIndex = new SessionIndexBuilder().buildObject();
        sessionIndex.setSessionIndex(sessionIdx);
        logoutReq.getSessionIndexes().add(sessionIndex);

        logoutReq.setReason("Single Logout");

        return logoutReq;
    }
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:30,代码来源:SAML2SSOManager.java


示例4: testChildElementsMarshall

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
    QName qname = new QName(SAMLConstants.SAML20P_NS, LogoutRequest.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    LogoutRequest req = (LogoutRequest) buildXMLObject(qname);
    
    super.populateChildElements(req);
    
    QName nameIDQName = new QName(SAMLConstants.SAML20_NS, NameID.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    req.setNameID((NameID) buildXMLObject(nameIDQName));
    
    QName sessionIndexQName = new QName(SAMLConstants.SAML20P_NS, SessionIndex.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    for (int i=0; i<expectedNumSessionIndexes; i++){
        req.getSessionIndexes().add((SessionIndex) buildXMLObject(sessionIndexQName));
    }
    
    assertEquals(expectedChildElementsDOM, req);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:18,代码来源:LogoutRequestTest.java


示例5: process

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
@Override
protected void process() throws SamlProcessingException, SamlSecurityException, UnsupportedSamlOperation {
	final LogoutRequest sloRequest = this.getOpenSamlObject();
	final ISaml20SpProcessor spProcessor = this.getSpProcessor();

	// Logout from SP
	final List<SessionIndex> sessionIndexes = sloRequest.getSessionIndexes();
	if (!CollectionUtils.isEmpty(sessionIndexes)) {
		for (final SessionIndex sessionIndex : sessionIndexes) {
			spProcessor.logout(sessionIndex.getSessionIndex());
		}
	}

	// Send SLO Response
	try {
		final SamlBindingEnum binding = SamlBindingEnum.SAML_20_HTTP_POST;
		final ISaml20IdpConnector idpConnector = this.findIdpConnector(sloRequest.getIssuer());
		final IOutgoingSaml sloResponseRequest = this.buildOutgoingSloResponse(sloRequest, binding, idpConnector);
		this.sendSloResponse(binding, sloResponseRequest);
	} catch (final SamlBuildingException e) {
		throw new SamlProcessingException("Unable to build SLO Response to send back to the IdP !", e);
	}
}
 
开发者ID:mxbossard,项目名称:java-saml2-sp,代码行数:24,代码来源:SloRequestQueryProcessor.java


示例6: createLogoutRequest

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public LogoutRequest createLogoutRequest(Response resp) {
  LogoutRequest lr = ((SAMLObjectBuilder<LogoutRequest>) 
        _bf.getBuilder(LogoutRequest.DEFAULT_ELEMENT_NAME)).buildObject();
  String uid = UUID.randomUUID().toString();
  
  lr.setID(uid);
  lr.setIssueInstant(new DateTime());
  lr.setVersion(SAMLVersion.VERSION_20);
  lr.setIssuer(getIssuer());
  
  // Get NameID and SessionIndex from first assertion from
  // Authentication Response object
  Assertion asr = resp.getAssertions().get(0);
  NameID nid = ((SAMLObjectBuilder<NameID>) 
      _bf.getBuilder(NameID.DEFAULT_ELEMENT_NAME)).buildObject();
  nid.setValue(asr.getSubject().getNameID().getValue());
  lr.setNameID(nid);
  
  // Set session index(es)
  List<AuthnStatement> ausl = asr.getAuthnStatements();
  if (ausl != null) {
    for (AuthnStatement aus :ausl) {
      SessionIndex sindex = ((SAMLObjectBuilder<SessionIndex>) 
          _bf.getBuilder(SessionIndex.DEFAULT_ELEMENT_NAME)).buildObject();
      sindex.setSessionIndex(aus.getSessionIndex());
      lr.getSessionIndexes().add(sindex);
    }
  }
  
  return lr;
}
 
开发者ID:osbitools,项目名称:OsBiToolsWs,代码行数:33,代码来源:SamlSecurityProvider.java


示例7: buildLogoutRequest

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/**
 * Generate a new LogoutRequest.
 * 
 * @param session The session containing the active assertion.
 * @param logoutServiceLocation Destination for the logout request.
 * @param issuerEntityId Entity ID of the issuing entity.
 */
@SuppressWarnings("deprecation")
public static OIOLogoutRequest buildLogoutRequest(HttpSession session, String logoutServiceLocation, String issuerEntityId, SessionHandler handler) {
	LogoutRequest logoutRequest = new LogoutRequestBuilder().buildObject();

	logoutRequest.setID(Utils.generateUUID());
	logoutRequest.setIssueInstant(new DateTime(DateTimeZone.UTC));
	logoutRequest.addNamespace(OIOSAMLConstants.SAML20_NAMESPACE);
	logoutRequest.setDestination(logoutServiceLocation);
	logoutRequest.setReason("urn:oasis:names:tc:SAML:2.0:logout:user");
	logoutRequest.setIssuer(SAMLUtil.createIssuer(issuerEntityId));

	OIOAssertion assertion = handler.getAssertion(session.getId());
	if (assertion != null) {
		NameID nameID = SAMLUtil.createNameID(assertion.getSubjectNameIDValue());
		nameID.setFormat(assertion.getAssertion().getSubject().getNameID().getFormat());
		logoutRequest.setNameID(nameID);
		SessionIndex sessionIndex = new SessionIndexBuilder().buildObject();
		logoutRequest.getSessionIndexes().add(sessionIndex);
		sessionIndex.setSessionIndex(assertion.getSessionIndex());
	}

	try {
		if (log.isDebugEnabled()) {
			log.debug("Validate the logoutRequest...");
		}
		logoutRequest.validate(true);
		if (log.isDebugEnabled()) {
			log.debug("...OK");
		}
	} catch (ValidationException e) {
		throw new WrappedException(Layer.CLIENT, e);
	}

	return new OIOLogoutRequest(logoutRequest);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:43,代码来源:OIOLogoutRequest.java


示例8: buildLogoutRequest

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/**
 * Build the logout request
 *
 * @param subject name of the user
 * @param reason  reason for generating logout request.
 * @return LogoutRequest object
 * @throws Exception
 */
public LogoutRequest buildLogoutRequest(String subject, String reason, String sessionIndexStr) throws Exception {
    log.info("Building logout request");
    Util.doBootstrap();
    LogoutRequest logoutReq = new org.opensaml.saml2.core.impl.LogoutRequestBuilder().buildObject();
    logoutReq.setID(Util.createID());
    logoutReq.setDestination(Util.getIdentityProviderSSOServiceURL());

    DateTime issueInstant = new DateTime();
    logoutReq.setIssueInstant(issueInstant);
    logoutReq.setNotOnOrAfter(new DateTime(issueInstant.getMillis() + 5 * 60 * 1000));

    IssuerBuilder issuerBuilder = new IssuerBuilder();
    Issuer issuer = issuerBuilder.buildObject();
    issuer.setValue(Util.getServiceProviderId());
    logoutReq.setIssuer(issuer);

    NameID nameId = new NameIDBuilder().buildObject();
    nameId.setFormat(SAML2SSOAuthenticatorConstants.SAML2_NAME_ID_POLICY_TRANSIENT);
    nameId.setValue(subject);
    logoutReq.setNameID(nameId);

    SessionIndex sessionIndex = new SessionIndexBuilder().buildObject();
    sessionIndex.setSessionIndex(sessionIndexStr);
    logoutReq.getSessionIndexes().add(sessionIndex);

    logoutReq.setReason(reason);

    Util.setSignature(logoutReq, XMLSignature.ALGO_ID_SIGNATURE_RSA, new SignKeyDataHolder());

    return logoutReq;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:40,代码来源:LogoutRequestBuilder.java


示例9: marshallElementContent

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
    SessionIndex si = (SessionIndex) samlObject;

    if (si.getSessionIndex() != null) {
        XMLHelper.appendTextContent(domElement, si.getSessionIndex());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:SessionIndexMarshaller.java


示例10: getSessionIndex

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/**
 * Get session index for a LogoutRequest.
 * 
 * @return The value. <code>null</code>, if the logout request does not
 *         contain any session indeces.
 */
public String getSessionIndex() {
	String retVal = null;
	if (request.getSessionIndexes() != null && request.getSessionIndexes().size() > 0) {
		SessionIndex sessionIndexStructure = request.getSessionIndexes().get(0);

		retVal = sessionIndexStructure.getSessionIndex();
	}
	return retVal;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:16,代码来源:OIOLogoutRequest.java


示例11: testGetSessionIndex

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
@Test
public void testGetSessionIndex() {
	assertNull(lh.getSessionIndex());

	SessionIndex idx = SAMLUtil.createSessionIndex("val");
	lr.getSessionIndexes().add(idx);
	
	assertEquals("val", lh.getSessionIndex());
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:10,代码来源:OIOLogoutRequestTest.java


示例12: testCreateSessionIndex

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
@Test
public void testCreateSessionIndex() {
	SessionIndex idx = SAMLUtil.createSessionIndex("idx");
	assertNotNull(idx);
	assertEquals("idx", idx.getSessionIndex());
	
	idx = SAMLUtil.createSessionIndex(null);
	assertNull(idx.getSessionIndex());
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:10,代码来源:SAMLUtilTest.java


示例13: testSessionIndexFailure

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/**
 * Tests invalid SessionIndex element content.
 */
public void testSessionIndexFailure() {
    SessionIndex si = (SessionIndex) target;
    
    si.setSessionIndex(null);
    assertValidationFail("SessionIndex was null");
    
    si.setSessionIndex("");
    assertValidationFail("SessionIndex was empty");
    
    si.setSessionIndex("            ");
    assertValidationFail("SessionIndex was all whitespace");
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:16,代码来源:SessionIndexSchemaTest.java


示例14: testSingleElementMarshall

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementMarshall() {
    QName qname = new QName(SAMLConstants.SAML20P_NS, SessionIndex.DEFAULT_ELEMENT_LOCAL_NAME);
    SessionIndex si = (SessionIndex) buildXMLObject(qname);
    
    si.setSessionIndex(expectedSessionIndex);
    
    assertEquals(expectedDOM, si);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:10,代码来源:SessionIndexTest.java


示例15: buildLogoutRequest

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/**
 * Build the logout request
 * @param subject name of the user
 * @param reason reason for generating logout request.
 * @return LogoutRequest object
 */
public LogoutRequest buildLogoutRequest(String subject,String sessionIndexId, String reason,
                                        String issuerId) {
    Util.doBootstrap();
    LogoutRequest logoutReq = new org.opensaml.saml2.core.impl.LogoutRequestBuilder().buildObject();
    logoutReq.setID(Util.createID());

    DateTime issueInstant = new DateTime();
    logoutReq.setIssueInstant(issueInstant);
    logoutReq.setNotOnOrAfter(new DateTime(issueInstant.getMillis() + 5 * 60 * 1000));

    IssuerBuilder issuerBuilder = new IssuerBuilder();
    Issuer issuer = issuerBuilder.buildObject();
    issuer.setValue(issuerId);
    logoutReq.setIssuer(issuer);

    NameID nameId = new NameIDBuilder().buildObject();
    nameId.setFormat(SSOConstants.SAML2_NAME_ID_POLICY);
    nameId.setValue(subject);
    logoutReq.setNameID(nameId);

    SessionIndex sessionIndex = new SessionIndexBuilder().buildObject();
    sessionIndex.setSessionIndex(sessionIndexId);
    logoutReq.getSessionIndexes().add(sessionIndex);

    logoutReq.setReason(reason);

    return logoutReq;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:35,代码来源:LogoutRequestBuilder.java


示例16: jsFunction_invalidateSessionBySAMLResponse

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/**
 * Invalidate current browser authenticated session based on SAML log out request session index value.
 *
 * @param cx
 * @param thisObj
 * @param args
 * @param funObj
 * @throws Exception
 */
public static void jsFunction_invalidateSessionBySAMLResponse(Context cx, Scriptable thisObj,
                                                              Object[] args,
                                                              Function funObj)
        throws Exception {
    int argLength = args.length;
    if (argLength != 1 || !(args[0] instanceof String)) {
        throw new ScriptException("Invalid argument. SAML log out request is missing.");
    }
    String decodedString = Util.decode((String) args[0]);

    SAMLSSORelyingPartyObject relyingPartyObject = (SAMLSSORelyingPartyObject) thisObj;
    XMLObject samlObject = Util.unmarshall(decodedString);
    String sessionIndex = null;
    if (samlObject instanceof LogoutRequest) {
        // if log out request
        LogoutRequest samlLogoutRequest = (LogoutRequest) samlObject;
        List<SessionIndex> sessionIndexes = samlLogoutRequest.getSessionIndexes();
        if (sessionIndexes != null && sessionIndexes.size() > 0) {
            sessionIndex = sessionIndexes.get(0).getSessionIndex();
        }
    }

    if (sessionIndex == null) {
        throw new Exception("Failed to get session index from session indexes in SAML logout request.");
    }

    relyingPartyObject.invalidateSessionBySessionIndex(sessionIndex);
    // this is to invalidate relying party object after user log out. To release memory allocations.
    invalidateRelyingPartyObject(relyingPartyObject.getSSOProperty(SSOConstants.ISSUER_ID));
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:40,代码来源:SAMLSSORelyingPartyObject.java


示例17: buildLogoutRequest

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/**
 * Build a SAML2 Single Logout Request.
 * 
 * @return the authentication request
 * @throws SamlBuildingException
 */
protected LogoutRequest buildLogoutRequest(final SamlBindingEnum binding, final IAuthentication auth)
		throws SamlBuildingException {
	final DateTime issueInstant = new DateTime();
	final LogoutRequest logoutRequest = this.logoutRequestBuilder.buildObject(LogoutRequest.DEFAULT_ELEMENT_NAME);

	logoutRequest.setIssueInstant(issueInstant);
	logoutRequest.setIssuer(this.buildIssuer());
	logoutRequest.setDestination(this.idpConfig.getIdpSloEndpointUrl(binding));
	logoutRequest.setVersion(SAMLVersion.VERSION_20);
	logoutRequest.setNotOnOrAfter(this.buildNotOnOrAfterTime(issueInstant));

	final String subjectId = auth.getSubjectId();
	if (!StringUtils.hasText(subjectId)) {
		// We don't know the subject so we cannot build a logout request
		throw new SamlBuildingException("No SAML 2.0 Subject can be found to build the Single Logout Request !");
	}

	final NameIDBuilder builder = new NameIDBuilder();
	final NameID newNameId = builder.buildObject(NameID.DEFAULT_ELEMENT_NAME);
	newNameId.setValue(subjectId);
	logoutRequest.setNameID(newNameId);

	final String sessionIndex = auth.getSessionIndex();
	if (StringUtils.hasText(sessionIndex)) {
		final SessionIndex sessionIndexObj = this.sessionIndexBuilder
				.buildObject(SessionIndex.DEFAULT_ELEMENT_NAME);
		sessionIndexObj.setSessionIndex(sessionIndex);
		logoutRequest.getSessionIndexes().add(sessionIndexObj);
	}

	this.getSaml20SpProcessor().signSamlObject(logoutRequest);

	return logoutRequest;
}
 
开发者ID:mxbossard,项目名称:java-saml2-sp,代码行数:41,代码来源:OpenSaml20IdpConnector.java


示例18: validate

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/** {@inheritDoc} */
public void validate(SessionIndex sessionIndex) throws ValidationException {
    validateSessionIndex(sessionIndex);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SessionIndexSchemaValidator.java


示例19: buildObject

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/** {@inheritDoc} */
public SessionIndex buildObject() {
    return buildObject(SAMLConstants.SAML20P_NS, SessionIndex.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20P_PREFIX);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:SessionIndexBuilder.java


示例20: getSessionIndexes

import org.opensaml.saml2.core.SessionIndex; //导入依赖的package包/类
/** {@inheritDoc} */
public List<SessionIndex> getSessionIndexes() {
    return sessionIndexes;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:LogoutRequestImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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