Documentation ¶
Overview ¶
Package identity implements the IndyKite Identity Service API Client.
Index ¶
- func ParseUUID(raw string) (uuid.UUID, error)
- type Client
- func (c *Client) CancelInvitation(ctx context.Context, referenceID string, opts ...grpc.CallOption) error
- func (c *Client) CheckConsentChallenge(ctx context.Context, req *identitypb.CheckOAuth2ConsentChallengeRequest, ...) (*identitypb.CheckOAuth2ConsentChallengeResponse, error)
- func (c *Client) CheckInvitationState(ctx context.Context, referenceID string, opts ...grpc.CallOption) (*identitypb.CheckInvitationStateResponse, error)
- func (c *Client) CheckInvitationToke(ctx context.Context, invitationToken string, opts ...grpc.CallOption) (*identitypb.CheckInvitationStateResponse, error)
- func (c *Client) Close() error
- func (c *Client) CreateConsent(ctx context.Context, req *identitypb.CreateConsentRequest, ...) (*identitypb.CreateConsentResponse, error)
- func (c *Client) CreateConsentVerifier(ctx context.Context, req *identitypb.CreateOAuth2ConsentVerifierRequest, ...) (*identitypb.CreateOAuth2ConsentVerifierResponse, error)
- func (c *Client) CreateEmailInvitation(ctx context.Context, invitee string, tenantID string, referenceID string, ...) error
- func (c *Client) EnrichToken(ctx context.Context, req *identitypb.EnrichTokenRequest, ...) (*identitypb.EnrichTokenResponse, error)
- func (c *Client) IntrospectToken(ctx context.Context, token string, opts ...grpc.CallOption) (*identitypb.TokenIntrospectResponse, error)
- func (c *Client) ListConsents(ctx context.Context, req *identitypb.ListConsentsRequest, ...) (identitypb.IdentityManagementAPI_ListConsentsClient, error)
- func (c *Client) ResendInvitation(ctx context.Context, referenceID string, opts ...grpc.CallOption) error
- func (c *Client) RevokeConsent(ctx context.Context, req *identitypb.RevokeConsentRequest, ...) (*identitypb.RevokeConsentResponse, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient creates a new Identity Management gRPC Client.
Example (Default) ¶
This example demonstrates how to create a new Identity Client.
package main import ( "context" "log" "github.com/indykite/indykite-sdk-go/identity" ) func main() { client, err := identity.NewClient(context.Background()) if err != nil { log.Fatalf("failed to create client %v", err) } _ = client.Close() }
Output:
Example (Options) ¶
This example demonstrates how to create a new Identity Client.
package main import ( "context" "log" api "github.com/indykite/indykite-sdk-go/grpc" "github.com/indykite/indykite-sdk-go/identity" ) func main() { client, err := identity.NewClient(context.Background(), api.WithCredentialsJSON([]byte(`{}`))) if err != nil { log.Fatalf("failed to create client %v", err) } _ = client.Close() }
Output:
func NewTestClient ¶
func NewTestClient(client identitypb.IdentityManagementAPIClient) (*Client, error)
NewTestClient creates a new Config Management gRPC Client.
func (*Client) CancelInvitation ¶
func (c *Client) CancelInvitation(ctx context.Context, referenceID string, opts ...grpc.CallOption) error
CancelInvitation revokes a pending invitation identified by referenceID.
func (*Client) CheckConsentChallenge ¶
func (c *Client) CheckConsentChallenge( ctx context.Context, req *identitypb.CheckOAuth2ConsentChallengeRequest, opts ...grpc.CallOption, ) (*identitypb.CheckOAuth2ConsentChallengeResponse, error)
func (*Client) CheckInvitationState ¶
func (c *Client) CheckInvitationState(ctx context.Context, referenceID string, opts ...grpc.CallOption) (*identitypb.CheckInvitationStateResponse, error)
CheckInvitationState checks the status of invitation.
func (*Client) CheckInvitationToke ¶
func (c *Client) CheckInvitationToke(ctx context.Context, invitationToken string, opts ...grpc.CallOption) (*identitypb.CheckInvitationStateResponse, error)
CheckInvitationToke checks the status of invitation.
func (*Client) Close ¶
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) CreateConsent ¶
func (c *Client) CreateConsent( ctx context.Context, req *identitypb.CreateConsentRequest, opts ...grpc.CallOption, ) (*identitypb.CreateConsentResponse, error)
func (*Client) CreateConsentVerifier ¶
func (c *Client) CreateConsentVerifier( ctx context.Context, req *identitypb.CreateOAuth2ConsentVerifierRequest, opts ...grpc.CallOption, ) (*identitypb.CreateOAuth2ConsentVerifierResponse, error)
func (*Client) CreateEmailInvitation ¶
func (c *Client) CreateEmailInvitation(ctx context.Context, invitee string, tenantID string, referenceID string, expireTime, inviteAtTime time.Time, messageAttributes map[string]any, opts ...grpc.CallOption) error
CreateEmailInvitation receive all properties for digital twin.
Example ¶
This example demonstrates the use of an identity client to create a new invitation and notify invitee via email.
package main import ( "context" "log" "time" "github.com/indykite/indykite-sdk-go/identity" ) func main() { client, err := identity.NewClient(context.Background()) if err != nil { log.Fatalf("failed to create client %v", err) } defer func() { _ = client.Close() }() err = client.CreateEmailInvitation(context.Background(), "test@example.com", "696e6479-6b69-4465-8000-030100000002", "my-reference", time.Now().AddDate(0, 0, 7), time.Now(), map[string]any{ "lang": "en", }) if err != nil { log.Printf("failed to invoke operation on IndyKite Client %v", err) } }
Output:
func (*Client) EnrichToken ¶
func (c *Client) EnrichToken( ctx context.Context, req *identitypb.EnrichTokenRequest, opts ...grpc.CallOption, ) (*identitypb.EnrichTokenResponse, error)
func (*Client) IntrospectToken ¶
func (c *Client) IntrospectToken(ctx context.Context, token string, opts ...grpc.CallOption) (*identitypb.TokenIntrospectResponse, error)
IntrospectToken function validates the token and returns information about it.
This is a protected operation and it can be accessed only with valid agent credentials!
Example ¶
This example demonstrates the use of a identity client to introspect the access_token from the request.
package main import ( "context" "log" "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/retry" "google.golang.org/protobuf/encoding/protojson" "github.com/indykite/indykite-sdk-go/identity" ) func main() { client, err := identity.NewClient(context.Background()) if err != nil { log.Fatalf("failed to create client %v", err) } defer func() { _ = client.Close() }() /* #nosec */ token := "JWT TOKEN HERE" tenant, err := client.IntrospectToken(context.Background(), token, retry.WithMax(2)) if err != nil { log.Fatalf("failed to invoke operation on IndyKite Client %v", err) } json := protojson.MarshalOptions{ Multiline: true, } println(json.Format(tenant)) }
Output:
func (*Client) ListConsents ¶
func (c *Client) ListConsents( ctx context.Context, req *identitypb.ListConsentsRequest, opts ...grpc.CallOption, ) (identitypb.IdentityManagementAPI_ListConsentsClient, error)
func (*Client) ResendInvitation ¶
func (c *Client) ResendInvitation(ctx context.Context, referenceID string, opts ...grpc.CallOption) error
ResendInvitation send invitation token to invitee.
func (*Client) RevokeConsent ¶
func (c *Client) RevokeConsent( ctx context.Context, req *identitypb.RevokeConsentRequest, opts ...grpc.CallOption, ) (*identitypb.RevokeConsentResponse, error)