auth

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

README

auth

import "github.com/coralproject/shelf/internal/platform/auth"

Overview

Index

Package files

keys.go signer.go

func DecodePrivateKey

func DecodePrivateKey(privateKeyBase64Str string) (*ecdsa.PrivateKey, error)

DecodePrivateKey pulls the private key out of the string passed by first decoding from base64 and parsing the PEM encoding.

func DecodePublicKey

func DecodePublicKey(publicKeyBase64Str string) (*ecdsa.PublicKey, error)

DecodePublicKey pulls the public key out of the string passed by first decoding from base64 and parsing the PEM encoding.

func SignRequest

func SignRequest(context interface{}, signer Signer, claims map[string]interface{}, r *http.Request) error

SignRequest will take a given signer, and adds a Authorization header with the token that is generated from the signer.

type Signer

type Signer func(claims map[string]interface{}) (string, error)

Signer is a function that can be used to sign claims with and generate a signed JWT token from them.

func NewSigner
func NewSigner(privateKeyBase64Str string) (Signer, error)

NewSigner will return a signer that can be used to sign tokens for a given set of claims.


Generated by godoc2md

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePrivateKey

func DecodePrivateKey(privateKeyBase64Str string) (*ecdsa.PrivateKey, error)

DecodePrivateKey pulls the private key out of the string passed by first decoding from base64 and parsing the PEM encoding.

func DecodePublicKey

func DecodePublicKey(publicKeyBase64Str string) (*ecdsa.PublicKey, error)

DecodePublicKey pulls the public key out of the string passed by first decoding from base64 and parsing the PEM encoding.

func SignRequest

func SignRequest(context interface{}, signer Signer, claims map[string]interface{}, r *http.Request) error

SignRequest will take a given signer, and adds a Authorization header with the token that is generated from the signer.

Types

type Signer

type Signer func(claims map[string]interface{}) (string, error)

Signer is a function that can be used to sign claims with and generate a signed JWT token from them.

func NewSigner

func NewSigner(privateKeyBase64Str string) (Signer, error)

NewSigner will return a signer that can be used to sign tokens for a given set of claims.

Jump to

Keyboard shortcuts

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