asap

package module
v0.0.0-...-4235b61 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

asap

Go Tests

A simple client package for ASAP authentication.

Installation

go get github.com/jasonfriedland/asap

Environment Variables

ASAP_PRIVATE_KEY=data:application/pkcs8;kid=webapp%2Fabc123;base64,...
ASAP_ISSUER=services/webapp
ASAP_AUDIENCE=webapp,webapp-service

Usage

Ensure the relevant environment variables are set. Then:

import "github.com/jasonfriedland/asap"

client, _ := asap.NewClient()
token, _ := client.AuthToken()

fmt.Printf("Bearer %s", token)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Kid        string
	Issuer     string
	Audience   []string
	PrivateKey *rsa.PrivateKey
	Expiry     uint64
}

Client holds the config that represents an ASAP JWT.

func NewClient

func NewClient() (*Client, error)

NewClient populates a new Client from the values set in the environment.

func (*Client) AuthToken

func (c *Client) AuthToken() (string, error)

AuthToken generates a unique Bearer token, which must be generated per-request.

Jump to

Keyboard shortcuts

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