client

package
v3.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 30 Imported by: 8

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, opts ...Option) (*Client, 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() oidcV2Beta_pb.OIDCServiceClient

func (*Client) OIDCServiceV2 added in v3.1.0

func (c *Client) OIDCServiceV2() oidcV2_pb.OIDCServiceClient

func (*Client) OrganizationService

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

func (*Client) OrganizationServiceV2 added in v3.1.0

func (c *Client) OrganizationServiceV2() orgV2.OrganizationServiceClient

func (*Client) SessionService

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

func (*Client) SessionServiceV2 added in v3.1.0

func (c *Client) SessionServiceV2() sessionV2.SessionServiceClient

func (*Client) SettingsService

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

func (*Client) SettingsServiceV2 added in v3.1.0

func (c *Client) SettingsServiceV2() settingsV2.SettingsServiceClient

func (*Client) SystemService

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

func (*Client) UserService

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

func (*Client) UserServiceV2 added in v3.1.0

func (c *Client) UserServiceV2() userV2.UserServiceClient

type Option

type Option func(*clientOptions)

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.

func WithGRPCDialOptions

func WithGRPCDialOptions(opts ...grpc.DialOption) Option

WithGRPCDialOptions allows to use custom grpc dial options when establishing connection with Zitadel. Multiple calls to WithGRPCDialOptions is allowed, options will be appended.

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