tokenmanager

package module
v4.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2022 License: MIT Imports: 8 Imported by: 0

README

Go-AlpJwtManager

Usage

package main

import "github.com/AlperTk/go-alpjwtmanager/v4"

func main() {
	var tokenManager = tokenmanager.NewTokenManager(
		"https://localhost:8443/auth/realms/marsrealm/protocol/openid-connect/token",
		"vpncontroller",
		"BMxjKIYZxqc3rJwWEci8TPO40mjVccls",
	)

	_, _ = tokenManager.GetBearerToken()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlpTokenManager

type AlpTokenManager interface {
	GetBearerToken() (string, error)
	RefreshToken() error
	ClearToken()
}

func NewTokenManager

func NewTokenManager(openIdConnectTokenUrl string, clientId string, secretKey string) AlpTokenManager

func NewTokenManagerWithCustomClient

func NewTokenManagerWithCustomClient(openIdConnectTokenUrl string, clientId string, secretKey string, client *http.Client) AlpTokenManager

type TokenResponseModel

type TokenResponseModel struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        int64  `json:"expires_in"`
	RefreshExpiresIn int64  `json:"refresh_expires_in"`
	RefreshToken     string `json:"refresh_token"`
	SessionState     string `json:"session_state"`
	TokenType        string `json:"token_type"`
	ExpiredAt        int64
	RefreshExpiredAt int64
}

Directories

Path Synopsis
internals

Jump to

Keyboard shortcuts

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