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

com.xlrit.gears.server.security.internal.InternalAuthentication Maven / Gradle / Ivy

There is a newer version: 1.17.6
Show newest version
package com.xlrit.gears.server.security.internal;

import java.util.List;

import org.springframework.security.authentication.AbstractAuthenticationToken;

import com.auth0.jwt.interfaces.DecodedJWT;
import com.xlrit.gears.engine.security.RoleAuthority;

public class InternalAuthentication extends AbstractAuthenticationToken {

    private final DecodedJWT decodedJwt;

    public InternalAuthentication(DecodedJWT decodedJwt, List roleNames) {
        super(RoleAuthority.fromRoleNames(roleNames));
        this.decodedJwt = decodedJwt;
        setAuthenticated(true);
    }

    @Override
    public Object getPrincipal() {
        return decodedJwt.getSubject();
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy