Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liam-middlebrook/csh-auth
https://github.com/liam-middlebrook/csh-auth
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/liam-middlebrook/csh-auth
- Owner: liam-middlebrook
- License: mit
- Created: 2017-08-02T21:37:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-24T02:57:10.000Z (over 4 years ago)
- Last Synced: 2023-08-04T22:11:29.781Z (over 1 year ago)
- Language: Go
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
csh-auth
========An @ComputerScienceHouse authentication wrapper for Gin.
## Usage
1. Create a CSHAuth Struct
```
csh := csh_auth.CSHAuth{}
```2. Initialize your CSHAuth object
```
csh.Init(
/* oidc_client_id */, // The OIDC client ID
/* oidc_client_secret */, // The OIDC client Secret
/* jwt_secret */, // I just used a random sequence of > 16 characters
/* state */, // I just used a random sequence of > 16 characters
/* server_host */, // The domain your application will run from
/* redirect_uri */, // The OIDC redirect URI
/* auth_uri */, // The relative path for your authentication endpoint
)
```3. Add required CSHAuth endpoints
```
r.GET("/auth/login", csh.AuthRequest) // This endpoint should match auth_uri
r.GET("/auth/redir", csh.AuthCallback) // This endpoint should match the relative portion of redirect_uri
r.Get("/auth/logout", csh.AuthLogout)
```4. Add endpoints to be behind authentication
```
r.Get("/hidden/prize", csh.AuthWrapper(endpoint_hidden_prize))
```