Package org.miniorange.saml
Class MoSAMLUtils
- java.lang.Object
-
- org.miniorange.saml.MoSAMLUtils
-
public class MoSAMLUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
RELAY_STATE_PARAM
static String
SAML_REQUEST_PARAM
static String
SAML_RESPONSE_PARAM
static String
SIGNATURE_ALGO_PARAM
static String
SIGNATURE_PARAM
-
Constructor Summary
Constructors Constructor Description MoSAMLUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
base64EncodeRequest(org.opensaml.xml.XMLObject request, Boolean isHttpPostBinding)
static org.opensaml.saml2.core.AuthnRequest
buildAuthnRequest(String issuer, String acsUrl, String destination, String nameIdFormat, Boolean forceAuthn, String authnContextClass)
static org.opensaml.saml2.core.RequestedAuthnContext
buildRequestedAuthnContext(String authnContextClassRefValue)
static org.opensaml.saml2.core.Response
decodeResponse(String encodedResponse)
static org.opensaml.saml2.core.Assertion
decryptAssertion(org.opensaml.saml2.core.EncryptedAssertion encryptedAssertion, String publicKey, String privateKey)
static String
deserializePrivateCertificate(String certificate)
static String
deserializePublicCertificate(String certificate)
static void
doBootstrap()
static String
generateRandomAlphaNumericKey(int bytes)
static String
generateRandomString()
static Boolean
isValidPublicCertificate(String certificate)
static String
sanitizeText(String text)
static String
serializePrivateCertificate(String certificate)
static String
serializePublicCertificate(String certificate)
static org.opensaml.common.SignableSAMLObject
signHttpPostRequest(org.opensaml.common.SignableSAMLObject request, String pubicKey, String privateKey)
static String
signHttpRedirectRequest(String requestQueryString, String sigAlgo, String pubicKey, String privateKey)
static Boolean
verifyCertificate(org.opensaml.xml.signature.SignableXMLObject response, String certificate)
-
-
-
Field Detail
-
SAML_REQUEST_PARAM
public static final String SAML_REQUEST_PARAM
- See Also:
- Constant Field Values
-
RELAY_STATE_PARAM
public static final String RELAY_STATE_PARAM
- See Also:
- Constant Field Values
-
SIGNATURE_ALGO_PARAM
public static final String SIGNATURE_ALGO_PARAM
- See Also:
- Constant Field Values
-
SIGNATURE_PARAM
public static final String SIGNATURE_PARAM
- See Also:
- Constant Field Values
-
SAML_RESPONSE_PARAM
public static final String SAML_RESPONSE_PARAM
- See Also:
- Constant Field Values
-
-
Method Detail
-
doBootstrap
public static void doBootstrap()
-
decodeResponse
public static org.opensaml.saml2.core.Response decodeResponse(String encodedResponse) throws Exception
- Throws:
Exception
-
buildAuthnRequest
public static org.opensaml.saml2.core.AuthnRequest buildAuthnRequest(String issuer, String acsUrl, String destination, String nameIdFormat, Boolean forceAuthn, String authnContextClass)
-
buildRequestedAuthnContext
public static org.opensaml.saml2.core.RequestedAuthnContext buildRequestedAuthnContext(String authnContextClassRefValue)
-
decryptAssertion
public static org.opensaml.saml2.core.Assertion decryptAssertion(org.opensaml.saml2.core.EncryptedAssertion encryptedAssertion, String publicKey, String privateKey) throws CertificateException, InvalidKeySpecException, NoSuchAlgorithmException, org.opensaml.xml.encryption.DecryptionException
- Throws:
CertificateException
InvalidKeySpecException
NoSuchAlgorithmException
org.opensaml.xml.encryption.DecryptionException
-
verifyCertificate
public static Boolean verifyCertificate(org.opensaml.xml.signature.SignableXMLObject response, String certificate) throws org.opensaml.xml.validation.ValidationException, CertificateException, InvalidKeySpecException, NoSuchAlgorithmException
- Throws:
org.opensaml.xml.validation.ValidationException
CertificateException
InvalidKeySpecException
NoSuchAlgorithmException
-
generateRandomString
public static String generateRandomString()
-
deserializePrivateCertificate
public static String deserializePrivateCertificate(String certificate)
-
base64EncodeRequest
public static String base64EncodeRequest(org.opensaml.xml.XMLObject request, Boolean isHttpPostBinding) throws Exception
- Throws:
Exception
-
signHttpRedirectRequest
public static String signHttpRedirectRequest(String requestQueryString, String sigAlgo, String pubicKey, String privateKey) throws Exception
- Throws:
Exception
-
signHttpPostRequest
public static org.opensaml.common.SignableSAMLObject signHttpPostRequest(org.opensaml.common.SignableSAMLObject request, String pubicKey, String privateKey) throws Exception
- Throws:
Exception
-
generateRandomAlphaNumericKey
public static String generateRandomAlphaNumericKey(int bytes)
-
-