oauth2

package
v0.0.0-...-462693d Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusBadRequest   = "StatusBadRequest"
	StatusInvalidToken = "StatusInvalidToken"
	StatusSuccess      = "StatusSuccess"
	StatusConfigErr    = "StatusConfigErr"
)

Error results of token verification

Variables

This section is empty.

Functions

func GetAccessToken

func GetAccessToken() (token string, err error)

GetAccessToken Get the access token to access NEF NF component. This API can

be ported to operator provided token access mechanism

i/p : None o/p token : The access token

err		: error code in case of failure or nil in success

func GetNEFAccessTokenFromNRF

func GetNEFAccessTokenFromNRF(accessTokenReq AccessTokenReq) (
	NefAccessToken string, err error)

GetNEFAccessTokenFromNRF Generates the token. This is the functionality of NRF component of 5GC

Types

type AccessTokenClaims

type AccessTokenClaims struct {
	Issuer     string      `json:"issuer"`
	Subject    string      `json:"subject"`
	Audience   interface{} `json:"audience"`
	Scope      string      `json:"scope"`
	Expiration int64       `json:"expiration"`
	jwt.StandardClaims
}

AccessTokenClaims struct

type AccessTokenReq

type AccessTokenReq struct {
	GrantType          string  `json:"grant_type"`
	NfInstanceID       string  `json:"nfInstanceId"`
	NfType             NfType  `json:"nfType,omitempty"`
	TargetNfType       NfType  `json:"targetNfType,omitempty"`
	Scope              string  `json:"scope"`
	TargetNfInstanceID string  `json:"targetNfInstanceId,omitempty"`
	RequesterPlmn      *PlmnID `json:"requesterPlmn,omitempty"`
	TargetPlmn         *PlmnID `json:"targetPlmn,omitempty"`
}

AccessTokenReq NRF access token request

type Config

type Config struct {
	SigningKey string `json:"signingkey"`
	Expiration int64  `json:"expiration"`
}

Config OAuth2 config struct

type NfType

type NfType string

NfType Network Function type

type PlmnID

type PlmnID struct {
	Mcc string `json:"mcc" yaml:"mcc" bson:"mcc" mapstructure:"Mcc"`
	Mnc string `json:"mnc" yaml:"mnc" bson:"mnc" mapstructure:"Mnc"`
}

PlmnID PLMN ID struct

type TokenVerificationResult

type TokenVerificationResult string

TokenVerificationResult Result of the token verification

func ValidateAccessToken

func ValidateAccessToken(reqToken string) (status TokenVerificationResult,
	err error)

ValidateAccessToken Validate the access token i/p reqToken : token to be validated o/p status : Success/Failure result of the operation

err    : error info of the token validation process.

Jump to

Keyboard shortcuts

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