1 package com.atlassian.asap.api.client.http;
2
3 import com.atlassian.asap.api.Jwt;
4 import com.atlassian.asap.api.exception.CannotRetrieveKeyException;
5 import com.atlassian.asap.api.exception.InvalidTokenException;
6
7 /**
8 * HTTP clients can use this service to generate the value of the Authorization header to be included in
9 * outgoing requests.
10 *
11 * @see <a href="http://s2sauth.bitbucket.org/">ASAP Authentication</a>
12 */
13 public interface AuthorizationHeaderGenerator {
14 /**
15 * Generates an HTTP Authorization header that includes a signed JWT.
16 *
17 * @param jwt the JWT object to be included in the authorization header
18 * @return the complete value of the Authorization header including the authentication scheme and the signed and serialized JWT
19 * @throws InvalidTokenException if the JWT is invalid or cannot be serialized
20 * @throws CannotRetrieveKeyException if the private key is not available
21 */
22 String generateAuthorizationHeader(Jwt jwt) throws InvalidTokenException, CannotRetrieveKeyException;
23 }