Skip to content

Commit 1402cd0

Browse files
committed
docs: add package doc for jwt auth
1 parent 5e07f2c commit 1402cd0

File tree

1 file changed

+27
-0
lines changed
  • apiserver/authentication/jwt

1 file changed

+27
-0
lines changed

apiserver/authentication/jwt/doc.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2024 Canonical Ltd.
2+
// Licensed under the AGPLv3, see LICENCE file for details.
3+
4+
// Package jwt provides an authenticator which accepts a jwt as
5+
// the means to declare the user wanting access and the permissions
6+
// they have. It is used to authenticate Juju login requests against
7+
// the api endpoint, and raw http requests.
8+
//
9+
// This mechanism is used when a Juju Controller is registered with JAAS.
10+
// JAAS has its own permissions model with finer grained RBAC permissions
11+
// than Juju supports. JAAS will perform the authentication step and present
12+
// to Juju a jwt with the username and permissions matching what Juju supports.
13+
//
14+
// Juju uses a [github.com/juju/juju/apiserver/authentication.PermissionDelegator]
15+
// instance to look up what permissions a user has. For non jwt scenarios, these
16+
// come from the Juju permissions model; when a jwt is used these come from the jwt
17+
// and the Juju permission model is empty.
18+
//
19+
// To use this authentication mechanism, the controller is bootstrapped with the
20+
// 'login-token-refresh-url' attribute set to the JAAS jwt refresh endpoint.
21+
//
22+
// The other implication of configuring a controller to use this authentication
23+
// mechanism is that the discharge endpoint for cross model relation macaroons
24+
// is also set to point to JAAS, so that JAAS is the service that also validates
25+
// permissions for consuming offers.
26+
27+
package jwt

0 commit comments

Comments
 (0)