jwt

package
v0.0.0-...-36fd31d Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package jwt provides a helper function used to access ArangoDB servers using a JWT secret.

Authenticating with a JWT secret results in "super-user" access to the database.

To use a JWT secret to access your database, use code like this:

// Create an HTTP connection to the database
conn, err := http.NewConnection(http.ConnectionConfig{
	Endpoints: []string{"http://localhost:8529"},
})
if err != nil {
	// Handle error
}

// Prepare authentication
hdr, err := CreateArangodJwtAuthorizationHeader("yourJWTSecret", "yourUniqueServerID")
if err != nil {
	// Handle error
}
auth := driver.RawAuthentication(hdr)

// Create a client
c, err := driver.NewClient(driver.ClientConfig{
	Connection:     conn,
	Authentication: auth,
})
if err != nil {
	// Handle error
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateArangodJwtAuthorizationHeader

func CreateArangodJwtAuthorizationHeader(jwtSecret, serverID string) (string, error)

CreateArangodJwtAuthorizationHeader calculates a JWT authorization header, for authorization of a request to an arangod server, based on the given secret. If the secret is empty, nothing is done. Use the result of this function as input for driver.RawAuthentication.

Types

This section is empty.

Jump to

Keyboard shortcuts

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