All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ufoscout.coreutils.jwt.JwtService Maven / Gradle / Ivy

package com.ufoscout.coreutils.jwt;

import java.util.Date;

/**
 * Interface to parse and generate JWTs
 *
 * @author Francesco Cina'
 *
 */
public interface JwtService {

    /**
     * Generates a JWT from the payload
     * @param payload the JWT payload
     * @return
     */
     String generate(T payload);

    /**
	 * Generates a JWT from the payload
     * @param subject the JWT subject
	 * @param payload the JWT payload
	 * @return
	 */
     String generate(String subject, T payload);

    /**
     * Generates a JWT from the payload
     * @param subject the JWT subject
     * @param payload the JWT payload
     * @param createdDate the creation Date
     * @param expirationDate the expiration Date
     * @return
     */
     String generate(final String subject, final T payload, Date createdDate, Date expirationDate);

    /**
     * Parses a JWT and return the contained bean.
     * It throws {@link TokenExpiredException} if the token has expired.
     *
     * @param jwt
     * @param payloadClass
     * @return
     */
     T parse(String jwt, Class payloadClass) throws TokenExpiredException;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy