ginyourface

package module
v0.0.0-...-0f0a41f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2016 License: MIT Imports: 5 Imported by: 0

README

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Facecontrol

func Facecontrol() gin.HandlerFunc

Facecontrol middleware checks for token is session cookie on every request

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL