1 package com.atlassian.asap.core.serializer;
2
3 import com.atlassian.asap.api.Jwt;
4 import com.atlassian.asap.core.exception.SigningException;
5 import com.atlassian.asap.core.exception.UnsupportedAlgorithmException;
6
7 import java.security.PrivateKey;
8
9 /**
10 * Signs and serialises JWT tokens.
11 */
12 public interface JwtSerializer {
13 /**
14 * Write the JWT with an appropriate signature.
15 *
16 * @param jwt the JWT object to serialize as signed JWT
17 * @param privateKey the private key to use to sign the JWT
18 * @return a String serialisation of the JWT token
19 * @throws SigningException if there was a problem signing the JWT
20 * @throws UnsupportedAlgorithmException if the algorithm in the JWT headers is not supported
21 */
22 String serialize(Jwt jwt, PrivateKey privateKey) throws SigningException, UnsupportedAlgorithmException;
23 }