You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
49 lines
1.4 KiB
package com.fr.plugin.xxxx.saml.xxxx.saml.response; |
|
|
|
import com.fr.plugin.xxxx.saml.xxxx.saml.SAMLException; |
|
import com.fr.plugin.xxxx.saml.xxxx.saml.assertion.AuthnRequest; |
|
import org.jdom.Document; |
|
import org.jdom.output.XMLOutputter; |
|
|
|
import java.security.KeyStore.PrivateKeyEntry; |
|
|
|
public class RequestBuilder { |
|
private String issuer; |
|
private String serviceUrl; |
|
private PrivateKeyEntry privateKeyEntry; |
|
private String digestAlgorithm; |
|
private String signatureAlgorithm; |
|
public RequestBuilder(String issuer,String serviceUrl,PrivateKeyEntry privateKeyEntry) { |
|
this.issuer = issuer; |
|
this.serviceUrl = serviceUrl; |
|
this.privateKeyEntry = privateKeyEntry; |
|
} |
|
|
|
public String build() throws SAMLException { |
|
AuthnRequest authnRequest = new AuthnRequest(this.issuer, |
|
this.issuer, this.serviceUrl); |
|
authnRequest.setDigestAlgorithm(digestAlgorithm); |
|
authnRequest.setSignatureAlgorithm(signatureAlgorithm); |
|
|
|
Request request = new Request(authnRequest,this.privateKeyEntry); |
|
Document doc = new Document().setRootElement(request.toXML()); |
|
return new XMLOutputter().outputString(doc); |
|
} |
|
|
|
public String getDigestAlgorithm() { |
|
return digestAlgorithm; |
|
} |
|
|
|
public void setDigestAlgorithm(String digestAlgorithm) { |
|
this.digestAlgorithm = digestAlgorithm; |
|
} |
|
|
|
public String getSignatureAlgorithm() { |
|
return signatureAlgorithm; |
|
} |
|
|
|
public void setSignatureAlgorithm(String signatureAlgorithm) { |
|
this.signatureAlgorithm = signatureAlgorithm; |
|
} |
|
|
|
}
|
|
|