Documentation
¶
Overview ¶
Package auth provides functions that link up and communicate with Luminus authentication server.
Index ¶
Constants ¶
const AUTH_METHOD = "FormsAuthentication"
const CLIENT_ID = "E10493A3B1024F14BDC7D0D8B9F649E9-234390"
const CODE_URL = "" /* 295-byte string literal not displayed */
const CONTENT_TYPE = "application/x-www-form-urlencoded"
const CREDENTIALS_FILE_NAME = lominus.CREDENTIALS_FILE_NAME
const EXPIRY_HOURS = 1
const GRANT_TYPE = "authorization_code"
const JWT_URL = "https://luminus.nus.edu.sg/v2/api/login/adfstoken"
const POST = "POST"
const REDIRECT_URI = "https://luminus.nus.edu.sg/auth/callback"
const RESOURCE = "sg_edu_nus_oauth"
const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
Variables ¶
This section is empty.
Functions ¶
func RetrieveJwtToken ¶
func RetrieveJwtToken(credentials Credentials, save bool) (string, error)
RetrieveJwtToken takes in the user's Credentials and return a JWT token issued by Luminus authentication server.
func SaveCredentials ¶
func SaveCredentials(credentialsPath string, credentials Credentials) error
SaveCredentials saves the user's Credentials for future authentications or renewals of JWT data.
Types ¶
type Credentials ¶
Credentials struct is the datapack that describes the user's credentials.
func LoadCredentials ¶
func LoadCredentials(credentialsPath string) (Credentials, error)
LoadCredentials loads the user's Credentials data from local storage.
type JsonResponse ¶
type JsonResponse struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` }
JsonResponse struct is the datapack for containing API authentication response raw data.
type JwtData ¶
JwtData struct is the datapack that describes the user's JWT data.
func LoadJwtData ¶
LoadJwtData loads the user's JWT data from local storage.
type JwtExpiredError ¶
type JwtExpiredError struct{}
JwtExpiredError struct contains the JwtExpiredError which will be thrown when the JWT data has expired.
func (*JwtExpiredError) Error ¶
func (e *JwtExpiredError) Error() string
JwtExpiredError error to be thrown when the JWT data has expired.