Documentation ¶
Overview ¶
Package token provides the ability for inserting Vela token resources into or extracting Vela token resources from the middleware chain for the API.
Usage:
import "github.com/go-vela/server/router/middleware/token"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compose ¶
Compose generates the token unique to the provided user. It uses a secret hash, which is unique for every user, to sign the token which guarantees the signature is unique per token. The signed token is returned as a string.
func Parse ¶
Parse scans the signed JWT token as a string and extracts the user login from the claims to be looked up in the database. This function will return an error for a few different reasons:
* the token signature doesn't match what is expected * the token signing method doesn't match what is expected * the token is invalid (potentially expired or improper)
func Retrieve ¶
Retrieve gets the token from the provided request http.Request to be parsed and validated. This is called on every request to enable capturing the user making the request and validating they have the proper access. The following methods of providing authentication to Vela are supported:
* Bearer token in `Authorization` header
Types ¶
This section is empty.