|
|
@ -9,17 +9,20 @@ import ( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
const ( |
|
|
const ( |
|
|
userPath = "/auth/admin/realms/:realm/users" |
|
|
userPath = "/auth/admin/realms/:realm/users" |
|
|
usersAdminExtensionAPIPath = "/auth/realms/:realmReq/api/admin/realms/:realm/users" |
|
|
adminExtensionAPIPath = "/auth/realms/:realmReq/api/admin/realms/:realm" |
|
|
userCountPath = userPath + "/count" |
|
|
usersAdminExtensionAPIPath = adminExtensionAPIPath + "/users" |
|
|
userIDPath = userPath + "/:id" |
|
|
sendEmailAdminExtensionAPIPath = adminExtensionAPIPath + "/send-email" |
|
|
userGroupsPath = userIDPath + "/groups" |
|
|
userCountPath = userPath + "/count" |
|
|
userGroupIDPath = userGroupsPath + "/:groupId" |
|
|
userIDPath = userPath + "/:id" |
|
|
executeActionsEmailPath = userIDPath + "/execute-actions-email" |
|
|
userGroupsPath = userIDPath + "/groups" |
|
|
sendReminderEmailPath = "/auth/realms/:realm/onboarding/sendReminderEmail" |
|
|
userGroupIDPath = userGroupsPath + "/:groupId" |
|
|
smsAPI = "/auth/realms/:realm/smsApi" |
|
|
executeActionsEmailPath = userIDPath + "/execute-actions-email" |
|
|
sendSmsCode = smsAPI + "/sendNewCode" |
|
|
sendReminderEmailPath = "/auth/realms/:realm/onboarding/sendReminderEmail" |
|
|
shadowUser = userIDPath + "/federated-identity/:provider" |
|
|
smsAPI = "/auth/realms/:realm/smsApi" |
|
|
|
|
|
sendSmsCode = smsAPI + "/sendNewCode" |
|
|
|
|
|
sendSMSPath = smsAPI + "/sendSms" |
|
|
|
|
|
shadowUser = userIDPath + "/federated-identity/:provider" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
// GetUsers returns a list of users, filtered according to the query parameters.
|
|
|
// GetUsers returns a list of users, filtered according to the query parameters.
|
|
|
@ -124,3 +127,15 @@ func (c *Client) LinkShadowUser(accessToken string, reqRealmName string, userID |
|
|
_, err := c.post(accessToken, nil, url.Path(shadowUser), url.Param("realm", reqRealmName), url.Param("id", userID), url.Param("provider", provider), body.JSON(fedIDKC)) |
|
|
_, err := c.post(accessToken, nil, url.Path(shadowUser), url.Param("realm", reqRealmName), url.Param("id", userID), url.Param("provider", provider), body.JSON(fedIDKC)) |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SendEmail sends an email to a user
|
|
|
|
|
|
func (c *Client) SendEmail(accessToken string, reqRealmName string, realmName string, emailRep keycloak.EmailRepresentation) error { |
|
|
|
|
|
_, err := c.post(accessToken, nil, url.Path(sendEmailAdminExtensionAPIPath), url.Param("realmReq", reqRealmName), url.Param("realm", realmName), body.JSON(emailRep)) |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SendSMS sends an SMS to a user
|
|
|
|
|
|
func (c *Client) SendSMS(accessToken string, realmName string, smsRep keycloak.SMSRepresentation) error { |
|
|
|
|
|
_, err := c.post(accessToken, nil, url.Path(sendSMSPath), url.Param("realm", realmName), body.JSON(smsRep)) |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|