Package org.tomitribe.auth.signatures
Class Signer
- java.lang.Object
-
- org.tomitribe.auth.signatures.Signer
-
public class Signer extends java.lang.ObjectIt is an intentional part of the design that the same Signer instance can be reused on several HTTP Messages in a multi-threaded fashionThe supplied Signature instance will be used as the basis for all future signatures created from this Signer.
Each call to 'sign' will emit a Signature with the same 'keyId', 'algorithm', 'headers' but a newly calculated 'signature'
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcreateSigningString(java.lang.String method, java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> headers)Create and return the string which is used as input for the cryptographic signature.java.lang.StringcreateSigningString(java.lang.String method, java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> headers, java.lang.Long created, java.lang.Long expires)Create and return the string which is used as input for the cryptographic signature.Signaturesign(java.lang.String method, java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> headers)Create and return a HTTP signature object.
-
-
-
Method Detail
-
sign
public Signature sign(java.lang.String method, java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException
Create and return a HTTP signature object.- Parameters:
method- The HTTP method.uri- The path and query of the request target of the message. The value must already be encoded exactly as it will be sent in the request line of the HTTP message. No URL encoding is performed by this method.headers- The HTTP headers.- Returns:
- a Signature object containing the signed message.
- Throws:
java.io.IOException
-
createSigningString
public java.lang.String createSigningString(java.lang.String method, java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> headers, java.lang.Long created, java.lang.Long expires) throws java.io.IOExceptionCreate and return the string which is used as input for the cryptographic signature.- Parameters:
method- The HTTP method.uri- The path and query of the request target of the message. The value must already be encoded exactly as it will be sent in the request line of the HTTP message. No URL encoding is performed by this method.headers- The HTTP headers.created- The time when the signature is created.expires- The time when the signature expires.- Returns:
- The signing string.
- Throws:
java.io.IOException- when an exception occurs while creating the signing string.
-
createSigningString
public java.lang.String createSigningString(java.lang.String method, java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOExceptionCreate and return the string which is used as input for the cryptographic signature.- Parameters:
method- The HTTP method.uri- The URI path and query parameters.headers- The HTTP headers.- Returns:
- The signing string.
- Throws:
java.io.IOException- when an exception occurs while creating the signing string.
-
-