Package com.sparc.knappsack.security

Source Code of com.sparc.knappsack.security.SingleUseToken

package com.sparc.knappsack.security;

import com.sparc.knappsack.exceptions.TokenException;
import org.hsqldb.lib.MD5;

import java.io.Serializable;
import java.util.Date;

public class SingleUseToken implements Serializable {

    private static final long serialVersionUID = 7627478913836974129L;

    private Date date;
    private String sessionIdHash;

    public SingleUseToken(String sessionId) throws TokenException {
        try {
            MD5 md5 = new MD5();
            this.sessionIdHash = md5.digest(sessionId);
        } catch (Exception e) {
            throw new TokenException("Error creating SingleUseToken.", e);
        }

        date = new Date();
    }

    public Date getDate() {
        return (Date) date.clone();
    }

    public String getSessionIdHash() {
        return sessionIdHash;
    }

}
TOP

Related Classes of com.sparc.knappsack.security.SingleUseToken

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.