标签: opensaml

用于什么不同的NameID格式?

在SAML元数据文件中,定义了几种NameID格式,例如:

<NameIDFormat>urn:mace:shibboleth:1.0:nameIdentifier</NameIDFormat>

<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>

<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
Run Code Online (Sandbox Code Playgroud)

谁能解释一下这些用途是什么?有什么区别?

saml single-sign-on opensaml

52
推荐指数
3
解决办法
9万
查看次数

Eclipse中的Android错误:"无法执行dex:无法将新索引65799合并到非巨型指令中!"

我正在尝试使用Eclipse使用OpenSAML的Android项目.我在构建路径中添加了所有必需的jar文件.现在,当我将程序作为Android应用程序运行时,会出现以下错误:

[2012-11-18 11:52:59 - Dex Loader] Unable to execute dex: Cannot merge new index 67075 into a non-jumbo instruction!
[2012-11-18 11:52:59 - MyTestProgram] Conversion to Dalvik format failed: Unable to execute dex: Cannot merge new index 67075 into a non-jumbo instruction!
Run Code Online (Sandbox Code Playgroud)

我用Google搜索了一下,但没有出现任何问题.这个错误意味着什么?

eclipse android opensaml

47
推荐指数
5
解决办法
3万
查看次数

SAML工件的目的是什么?

我已经看到了一系列关于如何通过重定向在身份提供商(IdP),服务提供商(SP)和浏览器之间传递的流程图.但是现在我似乎没必要,所以我知道我错过了什么.

有人可以为我提供一个用例,与不使用SAML工件相比,需要(或非常有用)SAML工件?

谢谢.

saml opensaml saml-2.0

36
推荐指数
3
解决办法
4万
查看次数

如何从opensaml 2.6迁移到3.1.1

我必须将一个类从opensaml 2.6迁移到opensaml 3.1.1编译我获得了一些错误

1)

Element plaintextElement = getElementAssertion(inputBean);
String xml = XMLHelper.prettyPrintXML(plaintextElement);
Run Code Online (Sandbox Code Playgroud)

我在新版本中找不到类XMLHelper.

2)

DefaultBootstrap.bootstrap();
builderFactory = Configuration.getBuilderFactory();
Configuration.getMarshallerFactory().getMarshaller(assertion).marshall(assertion);
Run Code Online (Sandbox Code Playgroud)

我找不到类DefaultBootstrap,我找不到使用方法getBuilderFactory(),getMarshallerFactory()的类配置

3)

BasicCredential credential = new BasicCredential();
Run Code Online (Sandbox Code Playgroud)

现在,构造函数new BasicCredential()不可见.

我没有找到弃用指示的文档.我该怎么做才能将这个类移植到opensaml 3.1.1版本?

有人能帮助我吗?提前致谢.对不起,我的英语不好.

java migration opensaml

14
推荐指数
1
解决办法
6328
查看次数

使用OpenSAML在Java中使用SAML 2.0解密加密的断言

尝试使用SAML 2.0解密加密断言时遇到问题.我使用的库是OpenSAML Java库2.5.2.

加密的断言如下所示:

<EncryptedAssertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
<enc:EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" 
    xmlns:enc="http://www.w3.org/2001/04/xmlenc#">
  <enc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc" />
  <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
    <e:EncryptedKey xmlns:e="http://www.w3.org/2001/04/xmlenc#">
      <e:EncryptionMethod 
       Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">
        <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      </e:EncryptionMethod>
      <KeyInfo>
        <o:SecurityTokenReference 
           xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-
                    1.0.xsd">
          <o:KeyIdentifier 
            ValueType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-
                      1.1#ThumbprintSHA1"
            EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-
                      message-security-1.0#Base64Binary">
          1H3mV/pJAlVZAst/Dt0rqbBd67g=
          </o:KeyIdentifier>
        </o:SecurityTokenReference>
      </KeyInfo>
      <e:CipherData>
        <e:CipherValue>
   ... ENCRYPTED KEY HERE ...
        </e:CipherValue>
      </e:CipherData>
    </e:EncryptedKey>
  </KeyInfo>
  <enc:CipherData>
    <enc:CipherValue>
    ... ENCRYPTED ASSERTIONS HERE ...
    </enc:CipherValue>
  </enc:CipherData>
</enc:EncryptedData>
</EncryptedAssertion>
Run Code Online (Sandbox Code Playgroud)

我确实使用以下openssl命令将PEM格式的私钥转换为pkcs8格式:

openssl pkcs8 -topk8 -nocrypt -inform PEM -in rsa_private_key.key -outform DER -out rsa_private_key.pk8
Run Code Online (Sandbox Code Playgroud)

然后我准备尝试解密加密的断言.这是我的Java代码:

...
// Load the XML file and parse it. …
Run Code Online (Sandbox Code Playgroud)

java cryptography rsa opensaml saml-2.0

12
推荐指数
1
解决办法
2万
查看次数

如何读取用于OpenSAML的私钥?

好吧,这是另一个"我真的不知道从哪里开始"的问题,所以希望答案很简单.但是,我真的不知道要搜索什么,到目前为止我的尝试还没有被大量使用.

我想从(当前磁盘上)文件中读取私钥.最终,密钥将驻留在数据库中,但这对于当下来说已经足够好了,并且差异对解析密钥材料没有任何实际意义.我已经能够创建一个Credential保存密钥的公共部分的实例(由调试器确认),但我似乎无法弄清楚如何读取私有部分.密钥对生成为:

openssl genrsa 512 > d:\host.key
openssl req -new -x509 -nodes -sha1 -days 365 -key d:\host.key > d:\host.cert
Run Code Online (Sandbox Code Playgroud)

(是的,我知道很久以前就已经破坏了512位RSA密钥.但是,为了让API工作起来,我认为没有理由不必要地耗尽系统熵供应.)

到目前为止的代码是:

import org.opensaml.xml.security.credential.Credential;
import org.opensaml.xml.security.x509.BasicX509Credential;

private Credential getSigningCredential()
throws java.security.cert.CertificateException, IOException {
    BasicX509Credential credential = new BasicX509Credential();

    credential.setUsageType(UsageType.SIGNING);

    // read public key
    InputStream inStream = new FileInputStream("d:\\host.cert");
    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);
    inStream.close();
    credential.setEntityCertificate(cert);

    // TODO: read private key

    // done.
    return credential;
}
Run Code Online (Sandbox Code Playgroud)

但是如何将文件读host.key入私钥部分credential,以便我可以使用生成的Credential实例来签署数据?

java cryptography opensaml

11
推荐指数
1
解决办法
2万
查看次数

使用SAMLResponse令牌

基于SAML sp的身份验证具有以下简短的工作流程

  • 用户希望在sp访问应用程序.
  • sp将SAMLRequest令牌发送到idp.
  • idp使用它并生成SAMLResponse令牌.
  • idp将此SAMLResponse令牌发送到sp给出的AC-URL.

我的问题是sp如何使用此SAMLResponse令牌.逻辑是什么?如果我能得到一些JAVA代码帮助它将是有益的.

java authentication saml opensaml saml-2.0

11
推荐指数
2
解决办法
2万
查看次数

从Java中的给定XML创建OpenSAML断言

我一直在反对这一点,并开始取得进展.但是,我遇到了将SAML 2 Assertion(在XML中)的字符串表示形式转换为Assertion对象的问题.

看起来我正在org.w3c.dom.Document使用适当的数据获得有效数据,而且我似乎SAMLObjectBuilder<Assertion>从构建器工厂获得了有效数据,但是当我尝试将它们放在一起时,我得到的只是一个空白的断言; 主题,发行人,发行时间等都是null,尽管它们明确地在XML中设置.

有谁看到我做错了什么,并建议一个解决方案?

Document doc = loadXMLFromString(saml);

XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();

SAMLObjectBuilder<Assertion> assertionBuilder =
  (SAMLObjectBuilder<Assertion>)
  builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);

Assertion assertion = assertionBuilder.buildObject(doc.getDocumentElement());

String nameID = assertion.getSubject().getNameID().getValue();
Run Code Online (Sandbox Code Playgroud)

在nameID赋值处,assertion.getSubject()返回null,使表达式的其余部分失败.

我使用的示例是来自sstc-saml-tech-overview-2.0-draft-03,第10页的完整XML.

loadXMLFromString()上面的函数主要是从In Java借来的,我如何将XML解析为String而不是文件?

java xml saml opensaml

9
推荐指数
1
解决办法
8346
查看次数

HttpSession为SPRING_SECURITY_CONTEXT返回了null对象

我正在尝试将Spring Saml库集成到示例Web应用程序中,使用Shibboleth作为IDP.我可以加载登录页面,登录并显示索引页面.

问题是,当我点击其他链接时,webapp会将我重定向到登录页面,然后IDP会识别我并重定向到所请求的页面(如果网络速度很快,则很难看到这一点).这就像我没有登录Spring安全性.

我检查了日志,发现了这个:

org.springframework.security.web.context.HttpSessionSecurityContextRepository - HttpSession为SPRING_SECURITY_CONTEXT org.springframework.security.web.context.HttpSessionSecurityContextRepository返回了null对象 - 没有来自HttpSession的SecurityContext:org.apache.catalina.session.StandardSessionFacade@fde8fb.将创建一个新的.

这是web.xml

<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/spring/root-context.xml
        /WEB-INF/spring/security/securityContext.xml
    </param-value>
</context-param>
<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!-- Processes application requests -->
<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>



<!-- Custom error pages …
Run Code Online (Sandbox Code Playgroud)

spring spring-security opensaml saml-2.0 spring-saml

8
推荐指数
1
解决办法
1万
查看次数

是否应该多次接受相同的SAML响应两次?

SAML联合软件是否应该接受相同的SAML响应,只要它在允许的SAML令牌生存期内?

简单来说: IDP(标识提供者)发出SAML响应,然后SP(服务提供者)接受/处理它.可以在首次使用后立即重复使用相同的未修改的SAML响应吗?鉴于SAML发布时间戳在允许的范围内.

在安全方面,将SAML令牌(响应)限制为仅一次使用是有意义的,因此即使它被"中间人"窃取 - 它也不能被重用.但是为了实现这一点,软件需要在某处存储有关SAML响应的一些信息:序列号,整个事物的哈希值?

请提供一些链接,说明可能的解释和/或实施示例.

谢谢!亚历克斯.

soa saml single-sign-on opensaml

8
推荐指数
2
解决办法
3945
查看次数