package jws

import "github.com/docker/distribution/Godeps/_workspace/src/golang.org/x/oauth2/jws"

Package jws provides encoding and decoding utilities for signed JWS messages.

Index

Functions

func Encode

func Encode(header *Header, c *ClaimSet, signature *rsa.PrivateKey) (string, error)

Encode encodes a signed JWS with provided header and claim set.

Types

type ClaimSet

type ClaimSet struct {
	Iss   string `json:"iss"`             // email address of the client_id of the application making the access token request
	Scope string `json:"scope,omitempty"` // space-delimited list of the permissions the application requests
	Aud   string `json:"aud"`             // descriptor of the intended target of the assertion (Optional).
	Exp   int64  `json:"exp"`             // the expiration time of the assertion
	Iat   int64  `json:"iat"`             // the time the assertion was issued.
	Typ   string `json:"typ,omitempty"`   // token type (Optional).

	// Email for which the application is requesting delegated access (Optional).
	Sub string `json:"sub,omitempty"`

	// The old name of Sub. Client keeps setting Prn to be
	// complaint with legacy OAuth 2.0 providers. (Optional)
	Prn string `json:"prn,omitempty"`

	// See http://tools.ietf.org/html/draft-jones-json-web-token-10#section-4.3
	// This array is marshalled using custom code (see (c *ClaimSet) encode()).
	PrivateClaims map[string]interface{} `json:"-"`
	// contains filtered or unexported fields
}

ClaimSet contains information about the JWT signature including the permissions being requested (scopes), the target of the token, the issuer, the time the token was issued, and the lifetime of the token.

func Decode

func Decode(payload string) (*ClaimSet, error)

Decode decodes a claim set from a JWS payload.

type Header struct {
	// The algorithm used for signature.
	Algorithm string `json:"alg"`

	// Represents the token type.
	Typ string `json:"typ"`
}

Header represents the header for the signed JWS payloads.

Source Files

jws.go

Version
v2.3.0-rc.1+incompatible
Published
Jan 21, 2016
Platform
linux/amd64
Imports
11 packages
Last checked
3 minutes ago

Tools for package owners.