client

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//OrgHeader for setting the organisation context of client calls
	OrgHeader = "x-zitadel-orgid"
)

Variables

This section is empty.

Functions

func AuthorizedUserCtx

func AuthorizedUserCtx(ctx context.Context) context.Context

AuthorizedUserCtx will set the authorization token of the authorized context (user) to be used for a subsequent call. If there is no authorized context, the method will simply return the passed context back.

func BearerTokenCtx

func BearerTokenCtx(ctx context.Context, token string) context.Context

BearerTokenCtx will set the passed token to be used for a subsequent call.

func ScopeProjectID

func ScopeProjectID(projectID string) string

ScopeProjectID will add the requested projectID to the audience of the access and id token

func ScopeZitadelAPI

func ScopeZitadelAPI() string

ScopeZitadelAPI adds the projectID of ZITADEL to the audience

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, zitadel *zitadel.Zitadel, options ...Option) (_ *Client, err error)

func (*Client) AdminService

func (c *Client) AdminService() admin.AdminServiceClient

func (*Client) AuthService

func (c *Client) AuthService() auth.AuthServiceClient

func (*Client) ManagementService

func (c *Client) ManagementService() management.ManagementServiceClient

func (*Client) OIDCService

func (c *Client) OIDCService() oidc_pb.OIDCServiceClient

func (*Client) OrganizationService

func (c *Client) OrganizationService() org.OrganizationServiceClient

func (*Client) SessionService

func (c *Client) SessionService() session.SessionServiceClient

func (*Client) SettingsService

func (c *Client) SettingsService() settings.SettingsServiceClient

func (*Client) SystemService

func (c *Client) SystemService() system.SystemServiceClient

func (*Client) UserService

func (c *Client) UserService() user.UserServiceClient

type Option

type Option func(*Client)

func WithAuth

func WithAuth(initTokenSource TokenSourceInitializer) Option

WithAuth allows to set a token source as authorization, e.g. PAT, resp. provide an authentication mechanism, such as JWT Profile (JWTAuthentication) or Password (PasswordAuthentication) for service users.

type TokenSourceInitializer

type TokenSourceInitializer func(ctx context.Context, issuer string) (oauth2.TokenSource, error)

func DefaultServiceUserAuthentication

func DefaultServiceUserAuthentication(path string, scopes ...string) TokenSourceInitializer

DefaultServiceUserAuthentication is a short version of JWTAuthentication with a key.json read from a provided path.

func JWTAuthentication

func JWTAuthentication(file *client.KeyFile, scopes ...string) TokenSourceInitializer

JWTAuthentication allows using the OAuth2 JWT Profile Grant to get a token using a key.json of a service user provided by ZITADEL.

func PAT

PAT allows setting a service user personal access token to be used for authorization.

func PasswordAuthentication

func PasswordAuthentication(username, password string, scopes ...string) TokenSourceInitializer

PasswordAuthentication allows using the OAuth2 Client Credentials Grant to get a token using username and password of a service user provided by ZITADEL.

Jump to

Keyboard shortcuts

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