You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
817 B
24 lines
817 B
package keycloak
|
|
|
|
import (
|
|
"gopkg.in/h2non/gentleman.v2/plugins/url"
|
|
)
|
|
|
|
const (
|
|
groupsPath = "/auth/admin/realms/:realm/groups"
|
|
groupByIDPath = "/auth/admin/realms/:realm/groups/:id"
|
|
)
|
|
|
|
// GetGroups gets all groups for the realm
|
|
func (c *Client) GetGroups(accessToken string, realmName string) ([]GroupRepresentation, error) {
|
|
var resp = []GroupRepresentation{}
|
|
var err = c.get(accessToken, &resp, url.Path(groupsPath), url.Param("realm", realmName))
|
|
return resp, err
|
|
}
|
|
|
|
// GetGroup gets a specific group’s representation
|
|
func (c *Client) GetGroup(accessToken string, realmName string, groupID string) (GroupRepresentation, error) {
|
|
var resp = GroupRepresentation{}
|
|
var err = c.get(accessToken, &resp, url.Path(groupByIDPath), url.Param("realm", realmName), url.Param("id", groupID))
|
|
return resp, err
|
|
}
|
|
|