auth

package module
v0.0.0-...-7a7d42c Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2015 License: Apache-2.0 Imports: 6 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

martini-keystone-auth

About:

Validates keystone auth tokens and injects them into the martini context.

Installation:

go get github.com/Kuwagata/martini-keystone-auth

Example usage:
package main

import (
	"github.com/go-martini/martini"
	"github.com/Kuwagata/martini-keystone-auth"
)

func main() {
	identity_tokens_endpoint := "https://identity.api.rackspacecloud.com/v2.0/tokens"

	redis_hostname := "localhost"
	redis_port := "6379"
	redis_pw := ""
	redis_db := int64(0)

	m := martini.Classic()
	m.Use(auth.Keystone(
		auth.GetIdentityValidator(identity_tokens_endpoint),
		auth.GetRedisCache(redis_hostname, redis_port, redis_pw, redis_db)))
	m.Get("/", func(token auth.Token) string {
		return string(token)
	})
	m.Run()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Keystone

func Keystone(validator TokenValidator, cache Cache) martini.Handler

Types

type Cache

type Cache interface {
	Get(key string) (string, error)
	Set(key, value string) error
}

func GetRedisCache

func GetRedisCache(hostname, port, password string, database int64) Cache

type IdentityValidator

type IdentityValidator struct {
	// contains filtered or unexported fields
}

func (IdentityValidator) ValidateToken

func (i IdentityValidator) ValidateToken(token string) bool

type Redis

type Redis struct {
	// contains filtered or unexported fields
}

func (Redis) Get

func (r Redis) Get(key string) (string, error)

func (Redis) Set

func (r Redis) Set(key, value string) error

type Token

type Token string

type TokenValidator

type TokenValidator interface {
	ValidateToken(token string) bool
}

func GetIdentityValidator

func GetIdentityValidator(auth_url string) TokenValidator

Jump to

Keyboard shortcuts

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