Browse Source

Add send new enrolment code API

master
Sonia 7 years ago
committed by harture
parent
commit
b007b335eb
  1. 17
      users.go

17
users.go

@ -9,14 +9,16 @@ import (
const ( const (
userPath = "/auth/admin/realms/:realm/users" userPath = "/auth/admin/realms/:realm/users"
usersAdminExtensionApiPath = "/auth/realms/:realmReq/api/admin/realms/:realm/users" usersAdminExtensionApiPath = "/auth/realms/:realmReq/api/admin/realms/:realm/users"
userCountPath = userPath + "/count" userCountPath = userPath + "/count"
userIDPath = userPath + "/:id" userIDPath = userPath + "/:id"
userGroupsPath = userIDPath + "/groups" userGroupsPath = userIDPath + "/groups"
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"
getCredentialsForUserPath = usersAdminExtensionApiPath +"/:id/credentials" smsAPI = "/auth/realms/:realm/smsApi"
sendNewEnrolmentCode = smsAPI + "/sendNewCode"
getCredentialsForUserPath = usersAdminExtensionApiPath + "/:id/credentials"
deleteCredentialsForUserPath = getCredentialsForUserPath + "/:credid" deleteCredentialsForUserPath = getCredentialsForUserPath + "/:credid"
) )
@ -98,6 +100,17 @@ func (c *Client) ExecuteActionsEmail(accessToken string, realmName string, userI
return c.put(accessToken, plugins...) return c.put(accessToken, plugins...)
} }
// Send a new enrolment code
func (c *Client) SendNewEnrolmentCode(accessToken string, realmName string, userID string) error {
var paramKV []string
paramKV = append(paramKV, "userid", userID)
var plugins = append(createQueryPlugins(paramKV...), url.Path(sendNewEnrolmentCode), 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