Search in sources :

Example 11 with JwsSignatureProvider

use of org.apache.cxf.rs.security.jose.jws.JwsSignatureProvider in project cxf by apache.

the class JoseSessionTokenProvider method protectStateString.

private String protectStateString(String stateString) {
    JwsSignatureProvider jws = getInitializedSigProvider();
    JweEncryptionProvider jwe = getInitializedEncryptionProvider();
    if (jws == null && jwe == null) {
        throw new OAuthServiceException("Session token can not be created");
    }
    if (jws != null) {
        stateString = JwsUtils.sign(jws, stateString, null);
    }
    if (jwe != null) {
        stateString = jwe.encrypt(StringUtils.toBytesUTF8(stateString), null);
    }
    return stateString;
}
Also used : JweEncryptionProvider(org.apache.cxf.rs.security.jose.jwe.JweEncryptionProvider) JwsSignatureProvider(org.apache.cxf.rs.security.jose.jws.JwsSignatureProvider)

Aggregations

JwsSignatureProvider (org.apache.cxf.rs.security.jose.jws.JwsSignatureProvider)11 JwsHeaders (org.apache.cxf.rs.security.jose.jws.JwsHeaders)7 Properties (java.util.Properties)5 JweEncryptionProvider (org.apache.cxf.rs.security.jose.jwe.JweEncryptionProvider)4 ArrayList (java.util.ArrayList)3 JwsCompactProducer (org.apache.cxf.rs.security.jose.jws.JwsCompactProducer)3 JwsJwtCompactProducer (org.apache.cxf.rs.security.jose.jws.JwsJwtCompactProducer)3 JwsSignature (org.apache.cxf.rs.security.jose.jws.JwsSignature)3 OutputStream (java.io.OutputStream)2 Instant (java.time.Instant)2 List (java.util.List)2 Base64UrlOutputStream (org.apache.cxf.common.util.Base64UrlOutputStream)2 CachedOutputStream (org.apache.cxf.io.CachedOutputStream)2 Message (org.apache.cxf.message.Message)2 JweHeaders (org.apache.cxf.rs.security.jose.jwe.JweHeaders)2 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 URL (java.net.URL)1 StandardCharsets (java.nio.charset.StandardCharsets)1 KeyStore (java.security.KeyStore)1