zalando

package
v0.0.0-...-790abed Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package zalando contains Zalando specific definitions for authorization.

Index

Constants

This section is empty.

Variables

View Source
var AccessTuples []AccessTuple

AccessTuples has to be set by the client to grant access.

View Source
var OAuth2Endpoint = oauth2.Endpoint{
	AuthURL:  "https://token.auth.zalando.com/access_token",
	TokenURL: "https://info.services.auth.zalando.com/oauth2/tokeninfo",
}

OAuth2Endpoint is similar to the definitions in golang.org/x/oauth2

View Source
var TeamAPI string = "https://teams.auth.zalando.com/api/teams"

TeamAPI is a custom API

Functions

func GroupCheck

func GroupCheck(at []AccessTuple) func(tc *ginoauth2.TokenContainer, ctx *gin.Context) bool

GroupCheck is an authorization function that checks, if the Token was issued for an employee of a specified team. The given TokenContainer must be valid. As side effect it sets "uid" and "team" in the gin.Context to the "official" team.

func NoAuthorization

func NoAuthorization() func(tc *ginoauth2.TokenContainer, ctx *gin.Context) bool

NoAuthorization sets "team" and "uid" in the context without checking if the user/team is authorized.

func RequestTeamInfo

func RequestTeamInfo(tc *ginoauth2.TokenContainer, uri string) ([]byte, error)

RequestTeamInfo is a function that returns team information for a given token.

func UidCheck

func UidCheck(at []AccessTuple) func(tc *ginoauth2.TokenContainer, ctx *gin.Context) bool

UidCheck is an authorization function that checks UID scope TokenContainer must be Valid. As side effect it sets "uid" and "cn" in the gin.Context to the authorized uid and cn (Realname).

Types

type AccessTuple

type AccessTuple struct {
	Realm string `yaml:"realm,omitempty"` // p.e. "employees", "services"
	Uid   string `yaml:"uid,omitempty"`   // UnixName
	Cn    string `yaml:"cn,omitempty"`    // RealName
}

AccessTuple is the type defined for use in AccessTuples.

type TeamInfo

type TeamInfo struct {
	Id      string
	Id_name string
	Team_id string
	Type    string
	Name    string
	Mail    []string
}

TeamInfo is defined like in TeamAPI json.

Jump to

Keyboard shortcuts

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