Esempio n. 1
0
  protected void setUp() throws Exception {
    super.setUp();

    X509Certificate xmldapCert = XmldapCertsAndKeys.getXmldapCert();
    xmldapKey = XmldapCertsAndKeys.getXmldapPrivateKey();

    //		X509Certificate relyingPartyCert = xmldapCert;
    RSAPublicKey signingKey = (RSAPublicKey) xmldapCert.getPublicKey();
    String signingAlgorithm = "SHA1withRSA";
    SelfIssuedToken token = new SelfIssuedToken(signingKey, xmldapKey, signingAlgorithm);

    token.setPrivatePersonalIdentifier(Base64.encodeBytesNoBreaks("ppid".getBytes()));
    token.setValidityPeriod(-5, 10);
    token.setConfirmationMethodBEARER();

    selfIssuedTokenStr = token.toXML();
    // e.g.:
    // <saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" MajorVersion="1"
    // MinorVersion="1"
    // AssertionID="uuid-8A443583-6887-6A21-D5D8-811EEF95AE32"
    // Issuer="http://schemas.xmlsoap.org/ws/2005/05/identity/issuer/self"
    // IssueInstant="2007-09-13T09:05:03Z">
    // <saml:Conditions NotBefore="2007-09-13T09:00:02Z" NotOnOrAfter="2007-09-13T09:15:02Z" />
    // <saml:AttributeStatement><saml:Subject>
    // <saml:SubjectConfirmation><saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</saml:ConfirmationMethod>
    // </saml:SubjectConfirmation></saml:Subject>
    // <saml:Attribute AttributeName="privatepersonalidentifier"
    // AttributeNamespace="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/">
    // <saml:AttributeValue>cHBpZA==</saml:AttributeValue></saml:Attribute></saml:AttributeStatement>
    // <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:SignedInfo>
    // <dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
    // <dsig:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
    // <dsig:Reference URI="#uuid-8A443583-6887-6A21-D5D8-811EEF95AE32"><dsig:Transforms>
    // <dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
    // <dsig:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></dsig:Transforms>
    // <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    // <dsig:DigestValue>mqNBJacR2OJcr2UTHf4oGU6xYg4=</dsig:DigestValue></dsig:Reference>
    // </dsig:SignedInfo>
    // <dsig:SignatureValue>xydYzGbfpdGPA0KIUCVn/UHsekDF67X/a7yAUxaae9T5XeGeiFXv4Mb/GGG41c4J
    // Su7eA1/5Wcz4a0Wl/woArL7z812SFubyVeKqCDDXTOus38Me5CCHfKdAqVNQi2nTDPF4g4plc8JeZNpAF8ATA
    // GaCPU8O4vwr6SfueFILMOBrOUc9DKzi8i0Bc7uJ1niODoUBgBn+OmGAdCX1lZgwGmXpid1WoiCzBkJ+luihF7
    // GZ757Xys7CgH389eBO560fXMG9eHdDy4cw3x71ozq8XglcegJkxfLD5cNolsMIuj7ufxi/x6Wp0fkhRyC3V9O
    // M2tbxH+kIKltMQQrN4OcLVw==</dsig:SignatureValue><dsig:KeyInfo><dsig:KeyValue>
    // <dsig:RSAKeyValue><dsig:Modulus>ANMnkVA4xfpG0bLos9FOpNBjHAdFahy2cJ7FUwuXd/IShnG+5qF/z
    // 1SdPWzRxTtpFFyodtXlBUEIbiT+IbYPZF1vCcBrcFa8Kz/4rBjrpPZgllgA/WSVKjnJvw8q4/tO6CQZSlRlj/
    // ebNK9VyT1kN+MrKV1SGTqaIJ2l+7Rd05WHscwZMPdVWBbRrg76YTfy6H/NlQIArNLZanPvE0Vd5QfD4ZyG2hT
    // h3y7ZlJAUndGJ/kfZw8sKuL9QSrh4eOTc280NQUmPGz6LP5MXNmu0RxEcomod1+ToKll90yEKFAUKuPYFgm9J
    // +vYm4tzRequLy/njteRIkcfAdcAtt6PCYjU=</dsig:Modulus><dsig:Exponent>AQAB</dsig:Exponent>
    // </dsig:RSAKeyValue></dsig:KeyValue></dsig:KeyInfo></dsig:Signature></saml:Assertion>

  }