skvauth

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ClientID string
	JWT      *JWT
	// contains filtered or unexported fields
}

Client holds the object of skatteverket

func New

func New(config *Config) *Client

New creates a new instance of skatteverket

func (*Client) EnsureJWT

func (c *Client) EnsureJWT(ctx context.Context) error

EnsureJWT ensure that a jwt is present and valid

type Config

type Config struct {
	CertificatePEM []byte
	PrivateKeyPEM  []byte
	BaseURL        string
	ProxyURL       string
	Scope          string
	ClientSecret   string
	ClientID       string
	GrantType      string
}

type Error

type Error interface {
	Error() string
}

Error interface

type Errors

type Errors struct {
	Detail []struct {
		Loc  []string `json:"loc"`
		Msg  string   `json:"msg"`
		Type string   `json:"type"`
	} `json:"detail"`
}

Errors is a general error reply

func (*Errors) Error

func (e *Errors) Error() string

type JWT

type JWT struct {
	sync.RWMutex
	RAW       string
	ExpiresAt int64
	IssuedAt  int64
	NotBefore int64
}

JWT holds the raw token, mutex lock and expiration dates

func (*JWT) Valid

func (jwt *JWT) Valid() bool

Valid checks if jwt token i valid of not

type JWTReply

type JWTReply struct {
	AccessToken string `json:"access_token" validate:"required"`
	ExpiresIn   int64  `json:"expires_in" validate:"required"`
	TokenType   string `json:"token_type" validate:"required"`
	Scope       string `json:"scope" validate:"required"`
}

Jump to

Keyboard shortcuts

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