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

be.looorent.security.jwt.UnauthenticatedToken Maven / Gradle / Ivy

package be.looorent.security.jwt;

import org.springframework.security.core.userdetails.UserDetails;

import javax.servlet.http.HttpServletRequest;

/**
 * A token that is not authenticated yet.
 * @author Lorent Lempereur - [email protected]
 */
class UnauthenticatedToken extends Jwt {

    private final HttpServletRequest request;

    /**
     * @param jwt a string representation of the Token. Must not be empty or Base64-encoded.
     */
    UnauthenticatedToken(String jwt, HttpServletRequest request) {
        super(jwt);
        setAuthenticated(false);
        this.request = request;
    }

    @Override
    AuthenticatedToken authenticate(UserDetails principal) {
        return new AuthenticatedToken(getJwtAsString(), principal);
    }

    @Override
    public Object getCredentials() {
        return null;
    }

    @Override
    public Object getPrincipal() {
        return null;
    }

    public HttpServletRequest getRequest() {
        return request;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy