Categorygithub.com/spurtcms/auth
modulepackage
0.0.34
Repository: https://github.com/spurtcms/auth.git
Documentation: pkg.go.dev

# README

Auth Package

This Auth package stands as a versatile, standalone module, tailored for seamless integration into any Golang project, promising flexibility and convenience. It isn't confined solely to any particular platform; it offers full freedom to incorporate it into any Golang platform. We have seamlessly integrated it with the spurtCMS admin system, ensuring a smooth integration process.

Features

  • Smooth admin login
  • Generates and returns an authentication token, typically used for user authentication and authorization processes.
  • Validates the authenticity and integrity of a given authentication token.
  • Check if a user login attempt is valid by verifying credentials against stored user information.
  • Parses and decrypts JWT tokens (Json Web Tokens) from the HTTP request's 'authorization' header
  • Verifies the validity of tokens using the provided jwtSecret

Installation

go get github.com/spurtcms/auth
  • Setup the Auth config
config := Config{
		UserId:     1,
		ExpiryTime: 2, // It should be in hours not minutes or seconds
		SecretKey:  "test@123",
		DB:         &gorm.DB{},
	}

	auth := AuthSetup(config)

Usage Example

func main (){

		config := Config{
			UserId:     1,
			ExpiryTime: 2, // It should be in hours not minutes or seconds
			SecretKey:  "test@123",
			DB:         &gorm.DB{},
		}
		
		auth := AuthSetup(config)
		
		//create token - generates new  JWtoken
		token, _ := auth.CreateToken()
		
		//checklogin - verifies user credentials
		token, userid,err :=auth.Checklogin("Username", "Password")
		
		//verifytoken - parses and verifies the token generated
		userid, err :=	auth.VerifyToken("token","secretkey","currenttime")
	}

Getting help

If you encounter a problem with the package,please refer [Please refer (https://www.spurtcms.com/documentation/cms-admin) or you can create a new Issue in this repo (https://github.com/spurtcms/auth/issues).

# Packages

No description provided by the author

# Functions

AuthSetup used initialize auth configruation.
No description provided by the author
Create meber token*/.
No description provided by the author
No description provided by the author
No description provided by the author
soft delete check.
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author