top

Package heimdall is a middleware for Martini that provides easy usage of the battle-arena auth process with jwt and cookies.

 package main

 import (
   "github.com/go-martini/martini"
   "github.com/battle-arena/heimdall-son"
	  "fmt"
 )

 func main() {
   m := martini.Classic()
   m.Use(heimdall.Gate(heimdall.Options{
		IdentityCookie: "identity",
		HeimdallEndpoint: "http://heimdall.localhost:9000",
		SignKey: "you-key-goes-here",
		ServiceName: "rooms",
		BaseUrl: "http://rooms.localhost:9001",
	  }))

   m.Get("/secured-route", func(heimdall heimdall.Heimdall) {
     identity := heimdall.Allow()
		fmt.Println(identity.Id + " - " + identity.Name)
   })

   m.Run()
 }

Imported by 4 package(s)

  1. github.com/battle-arena/var
  2. github.com/battle-arena/var/config
  3. github.com/battle-arena/var/context
  4. github.com/battle-arena/var/handler

Imports 2 package(s)

  1. github.com/dgrijalva/jwt-go
  2. github.com/go-martini/martini