Skip to content

Commit

Permalink
[CLOUDTRUST-4382] Add endpoint for TrustIDAuhtToken(#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
basbeu authored Jul 14, 2022
1 parent 07ede8e commit 3e054e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
shadowUser = userIDPath + "/federated-identity/:provider"
expiredToUAcceptancePath = adminRootPath + "/expired-tou-acceptance"
getSupportInfoPath = adminRootPath + "/support-infos"
generateTrustIDAuthToken = "/auth/realms/:realmReq/trustid-auth-token/realms/:realm/users/:userId/generate"
)

// GetUsers returns a list of users, filtered according to the query parameters.
Expand Down Expand Up @@ -174,3 +175,9 @@ func (c *Client) GetSupportInfo(accessToken string, email string) ([]keycloak.Em
err := c.get(accessToken, &emailInfos, url.Path(getSupportInfoPath), url.Param("realmReq", "master"), query.Add("email", email))
return emailInfos, err
}

func (c *Client) GenerateTrustIDAuthToken(accessToken string, reqRealmName string, realmName string, userID string) (string, error) {
var token keycloak.TrustIDAuthTokenRepresentation
err := c.get(accessToken, &token, url.Path(generateTrustIDAuthToken), url.Param("realmReq", reqRealmName), url.Param("realm", realmName), url.Param("userId", userID))
return *token.Token, err
}
4 changes: 4 additions & 0 deletions definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -809,3 +809,7 @@ type EmailInfoRepresentation struct {
RealmName *string `json:"realm,omitempty"`
CreationDate *int64 `json:"creationDate,omitempty"`
}

type TrustIDAuthTokenRepresentation struct {
Token *string `json:"token"`
}

0 comments on commit 3e054e5

Please sign in to comment.