Start cookie auth
This commit is contained in:
parent
deec023b7f
commit
0237c2796f
3 changed files with 9 additions and 6 deletions
1
TODO.md
1
TODO.md
|
@ -1 +1,2 @@
|
|||
#. Set up cookies
|
||||
#. Implement comments
|
||||
|
|
|
@ -42,6 +42,7 @@ type Claims struct {
|
|||
|
||||
type JWT struct {
|
||||
JWT string `json:"jwt"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
func Init() {
|
||||
|
@ -151,6 +152,7 @@ func signin(w http.ResponseWriter, r *http.Request) {
|
|||
_, tokenString, _ := TokenAuth.Encode(claims)
|
||||
token := JWT{
|
||||
JWT: tokenString,
|
||||
Username: creds.Username,
|
||||
}
|
||||
render.JSON(w, r, token)
|
||||
}
|
||||
|
|
Reference in a new issue