Skip to content

gobricks/ginyourface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Go Report Card

ginyourface

Gin middleware for facecontrol.

Basic example

Create file main.go and paste the following code into it:

package main

import (
    "github.com/gin-gonic/gin"

    "github.com/gobricks/ginyourface"
)

func main() {
    r := gin.New()

    // now every request will be validated through Facecontrol service
    // and userPayload will be returned if user has valid token
    r.Use(ginyourface.Facecontrol())
    
    r.GET("/personal", func(c *gin.Context) {
        userData := c.MustGet("userPayload").(interface{})
        c.String(http.StatusOK, "Hello %s", userData["username"])
    })

    r.Run(":8080")
}

Build and run

$ go build main.go
$ FC_HOST="https://facecontrol.mysite.com" FC_LOGIN_PAGE="https://login.mysite.com" FC_SESSION_COOKIE="sessid" ./main

About

Gin middleware for Facecontrol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages