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

de.kosmos_lab.web.persistence.ISesssionPersistence Maven / Gradle / Ivy

There is a newer version: 0.1.4
Show newest version
package de.kosmos_lab.web.persistence;

import de.kosmos_lab.web.data.User;
import org.json.JSONObject;

import javax.annotation.Nonnull;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Collection;

public interface ISesssionPersistence extends IPersistence {
    
    void addJWT(@Nonnull String token);
    
    
    /**
     * get the JWT with a specific jwtid back, if it is in the system and still valid
     *
     * @param jwtid the id to find
     * @return
     */
    JSONObject getJWT(@Nonnull String jwtid);
    
    /**
     * get the jwt for a user
     *
     * @param user
     * @return
     * @throws UnsupportedEncodingException
     * @throws NoSuchAlgorithmException
     * @throws InvalidKeyException
     */
    String getJWT(@Nonnull User user) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException;
    
    Collection getMySessions(String username);
    
    
    void killJWT(String jwtid);
    
    
    /**
     * verify the given jwt
     *
     * @param token
     * @return
     */
    JSONObject verifyJWT(@Nonnull String token);
    
    
    int initSesssions();
    
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy