Documentation
¶
Index ¶
- type AuthService
- func (s *AuthService) AuthMiddleware() gin.HandlerFunc
- func (s *AuthService) GetOktaAuthURL(state string) (string, error)
- func (s *AuthService) GetUserByEmail(ctx context.Context, email string) (*models.User, error)
- func (s *AuthService) HandleOktaCallback(ctx context.Context, code string) (string, error)
- func (s *AuthService) Login(ctx context.Context, email, password string) (string, error)
- func (s *AuthService) LoginWithOkta(ctx context.Context, oktaToken string) (string, error)
- func (s *AuthService) Register(ctx context.Context, email, password string) (string, error)
- func (s *AuthService) SetOktaService(oktaService *OktaService)
- type Claims
- type JWTManager
- type OktaService
- type OktaUserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService(userRepo *models.UserRepository, jwtManager *JWTManager, enableOkta bool) *AuthService
func (*AuthService) AuthMiddleware ¶
func (s *AuthService) AuthMiddleware() gin.HandlerFunc
func (*AuthService) GetOktaAuthURL ¶
func (s *AuthService) GetOktaAuthURL(state string) (string, error)
func (*AuthService) GetUserByEmail ¶
GetUserByEmail retrieves a user by their email
func (*AuthService) HandleOktaCallback ¶
func (*AuthService) LoginWithOkta ¶
func (*AuthService) SetOktaService ¶
func (s *AuthService) SetOktaService(oktaService *OktaService)
type Claims ¶
type Claims struct { UserID int64 `json:"user_id"` Email string `json:"email"` IsAdmin bool `json:"is_admin"` jwt.RegisteredClaims }
func ParseToken ¶
type JWTManager ¶
type JWTManager struct {
// contains filtered or unexported fields
}
func NewJWTManager ¶
func NewJWTManager(secretKey string, expiry time.Duration) *JWTManager
func (*JWTManager) GenerateToken ¶
func (m *JWTManager) GenerateToken(user *models.User) (string, error)
func (*JWTManager) ValidateToken ¶
func (m *JWTManager) ValidateToken(tokenStr string) (*Claims, error)
type OktaService ¶
type OktaService struct {
// contains filtered or unexported fields
}
func NewOktaService ¶
func NewOktaService(orgURL, clientID, clientSecret string, redirectURL string) (*OktaService, error)
func (*OktaService) ExchangeCode ¶
func (*OktaService) GetAuthURL ¶
func (s *OktaService) GetAuthURL(state string) string
func (*OktaService) ValidateToken ¶
func (s *OktaService) ValidateToken(ctx context.Context, tokenString string) (*OktaUserInfo, error)
type OktaUserInfo ¶
Click to show internal directories.
Click to hide internal directories.