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) ChangeMyPassword(ctx context.Context, token string, newPassword string, opts ...grpc.CallOption) error
- func (c *Client) ChangePasswordOfDigitalTwin(ctx context.Context, digitalTwin *identitypb.DigitalTwin, newPassword string, ...) (*identitypb.ChangePasswordResponse, 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) DeleteDigitalTwin(ctx context.Context, digitalTwin *identitypb.DigitalTwin, ...) (*identitypb.DigitalTwin, error)
- func (c *Client) DeleteDigitalTwinByToken(ctx context.Context, token string, opts ...grpc.CallOption) (*identitypb.DigitalTwin, error)
- func (c *Client) EnrichToken(ctx context.Context, req *identitypb.EnrichTokenRequest, ...) (*identitypb.EnrichTokenResponse, error)
- func (c *Client) GetDigitalTwin(ctx context.Context, digitalTwin *identitypb.DigitalTwin, ...) (*identitypb.GetDigitalTwinResponse, error)
- func (c *Client) GetDigitalTwinByToken(ctx context.Context, token string, properties []*identitypb.PropertyMask, ...) (*identitypb.GetDigitalTwinResponse, 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) PatchDigitalTwin(ctx context.Context, digitalTwin *identitypb.DigitalTwin, ...) ([]*identitypb.BatchOperationResult, error)
- func (c *Client) PatchDigitalTwinByToken(ctx context.Context, token string, ...) ([]*identitypb.BatchOperationResult, 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)
- func (c *Client) StartEmailVerification(ctx context.Context, digitalTwin *identitypb.DigitalTwin, email string, ...) error
- func (c *Client) VerifyDigitalTwinEmail(ctx context.Context, token string, opts ...grpc.CallOption) (*identitypb.DigitalTwin, 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) } defer func() { _ = 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) } defer func() { _ = 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) ChangeMyPassword ¶
func (c *Client) ChangeMyPassword(ctx context.Context, token string, newPassword string, opts ...grpc.CallOption, ) error
ChangeMyPassword change password of DigitalTwin from bearer token.
func (*Client) ChangePasswordOfDigitalTwin ¶
func (c *Client) ChangePasswordOfDigitalTwin(ctx context.Context, digitalTwin *identitypb.DigitalTwin, newPassword string, opts ...grpc.CallOption, ) (*identitypb.ChangePasswordResponse, error)
ChangePasswordOfDigitalTwin change password of passed DigitalTwin.
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]interface{}, 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]interface{}{ "lang": "en", }) if err != nil { log.Printf("failed to invoke operation on IndyKite Client %v", err) } }
Output:
func (*Client) DeleteDigitalTwin ¶
func (c *Client) DeleteDigitalTwin(ctx context.Context, digitalTwin *identitypb.DigitalTwin, opts ...grpc.CallOption, ) (*identitypb.DigitalTwin, error)
DeleteDigitalTwin deletes the digital twin.
func (*Client) DeleteDigitalTwinByToken ¶
func (c *Client) DeleteDigitalTwinByToken(ctx context.Context, token string, opts ...grpc.CallOption, ) (*identitypb.DigitalTwin, error)
DeleteDigitalTwinByToken deletes the digital twin.
func (*Client) EnrichToken ¶
func (c *Client) EnrichToken( ctx context.Context, req *identitypb.EnrichTokenRequest, opts ...grpc.CallOption, ) (*identitypb.EnrichTokenResponse, error)
func (*Client) GetDigitalTwin ¶
func (c *Client) GetDigitalTwin(ctx context.Context, digitalTwin *identitypb.DigitalTwin, properties []*identitypb.PropertyMask, opts ...grpc.CallOption, ) (*identitypb.GetDigitalTwinResponse, error)
GetDigitalTwin receive all properties for given digital twin.
func (*Client) GetDigitalTwinByToken ¶
func (c *Client) GetDigitalTwinByToken(ctx context.Context, token string, properties []*identitypb.PropertyMask, opts ...grpc.CallOption, ) (*identitypb.GetDigitalTwinResponse, error)
GetDigitalTwinByToken receive all properties for digital twin.
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 { // nolint:gocritic 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) PatchDigitalTwin ¶
func (c *Client) PatchDigitalTwin(ctx context.Context, digitalTwin *identitypb.DigitalTwin, operations []*identitypb.PropertyBatchOperation, forceDelete bool, opts ...grpc.CallOption, ) ([]*identitypb.BatchOperationResult, error)
PatchDigitalTwin update properties for given digital twin.
func (*Client) PatchDigitalTwinByToken ¶
func (c *Client) PatchDigitalTwinByToken(ctx context.Context, token string, operations []*identitypb.PropertyBatchOperation, forceDelete bool, opts ...grpc.CallOption, ) ([]*identitypb.BatchOperationResult, error)
PatchDigitalTwinByToken update properties for digital twin.
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)
func (*Client) StartEmailVerification ¶
func (c *Client) StartEmailVerification(ctx context.Context, digitalTwin *identitypb.DigitalTwin, email string, attributes *objects.MapValue, opts ...grpc.CallOption) error
StartEmailVerification function initiates the flow where Indykite systems sends a notification to DigitalTwin with a link to verify the control over the notification channel (email only for now).
This is a protected operation and it can be accessed only with valid agent credentials!
func (*Client) VerifyDigitalTwinEmail ¶
func (c *Client) VerifyDigitalTwinEmail(ctx context.Context, token string, opts ...grpc.CallOption) (*identitypb.DigitalTwin, error)
VerifyDigitalTwinEmail function confirms to IndyKite system that the message from StartDigitalTwinEmailVerification function was sent and user visited the link.
This is a protected operation and it can be accessed only with valid agent credentials!