Documentation ¶
Index ¶
- func GetKeyPrivate() (*rsa.PrivateKey, error)
- func GetKeyPublic() (*rsa.PublicKey, error)
- func MakeNewRefresh() *string
- func MakeNewToken(extraClaims map[string]interface{}) (*string, *jwt.Token, error)
- func MakeTestToken(user *users.User) (string, error)
- func RandomString(n int) string
- func RunGRPC(port int, tlsdir string)
- func UserClaims(user *users.User) map[string]interface{}
- type Server
- func (s *Server) Authenticate(ctx context.Context, request *pb.AuthRequest) (*pb.AuthResponse, error)
- func (s *Server) Refresh(context.Context, *pb.RefreshRequest) (*pb.AuthResponse, error)
- func (s *Server) RevokeToken(ctx context.Context, request *pb.Revoke) (*pb.Empty, error)
- func (s *Server) SocialLogin(ctx context.Context, request *pb.SocialRequest) (*pb.AuthResponse, error)
- func (s *Server) VerifyToken(ctx context.Context, request *pb.VerifyTokenRequest) (*pb.VerifyTokenResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKeyPrivate ¶
func GetKeyPrivate() (*rsa.PrivateKey, error)
GetKeyPrivate reads a private PEM formatted RSA cert
func GetKeyPublic ¶
GetKeyPublic reads a public PEM formatted RSA cert
func MakeNewToken ¶
MakeNewToken creates a new JWT token for the specific user
func MakeTestToken ¶
MakeTestToken makes a temporary JWT token which expires in 4
*seconds specifically for testing purposes
func RandomString ¶
RandomString generates a n lengthed string (cryptographically)
func UserClaims ¶
UserClaims takes in a user and applies the standard user claims
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server basic Server construct
func NewServer ¶
func NewServer() *Server
NewServer creates a ne struct to interface the auth server
func (*Server) Authenticate ¶
func (s *Server) Authenticate(ctx context.Context, request *pb.AuthRequest) (*pb.AuthResponse, error)
Authenticate takes in oneof a authentication types and tries to generate tokens
func (*Server) Refresh ¶
func (s *Server) Refresh(context.Context, *pb.RefreshRequest) (*pb.AuthResponse, error)
Refresh allows the creation of a auth token given a refresh token validating the refresh token has not been used before and has not expired
func (*Server) RevokeToken ¶
RevokeToken adds a token to the revoked tokens list
func (*Server) SocialLogin ¶
func (s *Server) SocialLogin(ctx context.Context, request *pb.SocialRequest) (*pb.AuthResponse, error)
SocialLogin validates remote idP tokens and creates users and passes back auth tokens
func (*Server) VerifyToken ¶
func (s *Server) VerifyToken(ctx context.Context, request *pb.VerifyTokenRequest) (*pb.VerifyTokenResponse, error)
VerifyToken takes in a VerifyTokenRequest, validates the token in that request