Browse Source

CLOUDTRUST-1392 Send reminder email API

master
Sonia 7 years ago
committed by harture
parent
commit
3ed290c1f2
  1. 2
      keycloak_client.go
  2. 14
      users.go

2
keycloak_client.go

@ -386,7 +386,6 @@ func str(s string) *string {
return &s return &s
} }
// Token is JWT token. // Token is JWT token.
// We need to define our own structure as the library define aud as a string but it can also be a string array. // We need to define our own structure as the library define aud as a string but it can also be a string array.
// To fix this issue, we remove aud as we do not use it here. // To fix this issue, we remove aud as we do not use it here.
@ -407,4 +406,3 @@ type header struct {
Type string `json:"typ,omitempty"` Type string `json:"typ,omitempty"`
ContentType string `json:"cty,omitempty"` ContentType string `json:"cty,omitempty"`
} }

14
users.go

@ -16,6 +16,7 @@ const (
resetPasswordPath = userIDPath + "/reset-password" resetPasswordPath = userIDPath + "/reset-password"
sendVerifyEmailPath = userIDPath + "/send-verify-email" sendVerifyEmailPath = userIDPath + "/send-verify-email"
executeActionsEmailPath = userIDPath + "/execute-actions-email" executeActionsEmailPath = userIDPath + "/execute-actions-email"
sendReminderEmailPath = "/auth/realms/:realm/onboarding/sendReminderEmail"
smsAPI = "/auth/realms/:realm/smsApi" smsAPI = "/auth/realms/:realm/smsApi"
sendNewEnrolmentCode = smsAPI + "/sendNewCode" sendNewEnrolmentCode = smsAPI + "/sendNewCode"
getCredentialsForUserPath = usersAdminExtensionApiPath + "/:id/credentials" getCredentialsForUserPath = usersAdminExtensionApiPath + "/:id/credentials"
@ -113,6 +114,19 @@ func (c *Client) SendNewEnrolmentCode(accessToken string, realmName string, user
return resp, err return resp, err
} }
// SendReminderEmail sends a reminder email to a user
func (c *Client) SendReminderEmail(accessToken string, realmName string, userID string, paramKV ...string) error {
if len(paramKV)%2 != 0 {
return fmt.Errorf("the number of key/val parameters should be even")
}
var newParamKV = append(paramKV, "userid", userID)
var plugins = append(createQueryPlugins(newParamKV...), url.Path(sendReminderEmailPath), url.Param("realm", realmName))
_, err := c.post(accessToken, nil, plugins...)
return err
}
// GetCredentialsForUser gets the credential list for a user // GetCredentialsForUser gets the credential list for a user
func (c *Client) GetCredentialsForUser(accessToken string, realmReq, realmName string, userID string) ([]CredentialRepresentation, error) { func (c *Client) GetCredentialsForUser(accessToken string, realmReq, realmName string, userID string) ([]CredentialRepresentation, error) {
var resp = []CredentialRepresentation{} var resp = []CredentialRepresentation{}

Loading…
Cancel
Save