5 changed files with 79 additions and 5 deletions
@ -1 +1,29 @@ |
|||
package keycloak |
|||
|
|||
import ( |
|||
"gopkg.in/h2non/gentleman.v2/plugins/body" |
|||
"gopkg.in/h2non/gentleman.v2/plugins/url" |
|||
) |
|||
|
|||
const ( |
|||
clientInitialAccessPath = "/auth/admin/realms/:realm/clients-initial-access" |
|||
) |
|||
|
|||
// CreateClientInitialAccess creates a new initial access token.
|
|||
func (c *Client) CreateClientInitialAccess(realmName string, access ClientInitialAccessCreatePresentation) (ClientInitialAccessPresentation, error) { |
|||
var resp = ClientInitialAccessPresentation{} |
|||
var err = c.post(url.Path(clientInitialAccessPath), url.Param("realm", realmName), body.JSON(access)) |
|||
return respasf, err |
|||
} |
|||
|
|||
// GetClientInitialAccess returns a list of clients initial access.
|
|||
func (c *Client) GetClientInitialAccess(realmName string) ([]ClientInitialAccessPresentation, error) { |
|||
var resp = []ClientInitialAccessPresentation{} |
|||
var err = c.get(&resp, url.Path(clientInitialAccessPath), url.Param("realm", realmName)) |
|||
return resp, err |
|||
} |
|||
|
|||
// DeleteClientInitialAccess deletes the client initial access.
|
|||
func (c *Client) DeleteClientInitialAccess(realmName, accessID string) error { |
|||
return c.delete(url.Path(clientInitialAccessPath+"/:id"), url.Param("realm", realmName), url.Param("id", accessID)) |
|||
} |
|||
|
|||
@ -1 +1,14 @@ |
|||
package keycloak |
|||
|
|||
import "gopkg.in/h2non/gentleman.v2/plugins/url" |
|||
|
|||
const ( |
|||
clientRegistrationPolicyPath = "/auth/admin/realms/:realm/client-registration-policy/providers" |
|||
) |
|||
|
|||
// GetClientRegistrationPolicy is the base path to retrieve providers with the configProperties properly filled.
|
|||
func (c *Client) GetClientRegistrationPolicy(realmName, configID string) ([]ComponentTypeRepresentation, error) { |
|||
var resp = []ComponentTypeRepresentation{} |
|||
var err = c.get(&resp, url.Path(clientRegistrationPolicyPath), url.Param("realm", realmName)) |
|||
return resp, err |
|||
} |
|||
|
|||
@ -1 +1,27 @@ |
|||
package keycloak |
|||
|
|||
import ( |
|||
"gopkg.in/h2non/gentleman.v2/plugins/body" |
|||
"gopkg.in/h2non/gentleman.v2/plugins/url" |
|||
) |
|||
|
|||
const ( |
|||
clientRoleMappingPath = "/auth/admin/realms/:realm/groups/:id/role-mappings/clients/:client" |
|||
) |
|||
|
|||
// CreateClientsRoleMapping add client-level roles to the user role mapping.
|
|||
func (c *Client) CreateClientsRoleMapping(realmName, groupID, clientID string, roles []RoleRepresentation) error { |
|||
return c.post(url.Path(clientRoleMappingPath), url.Param("realm", realmName), url.Param("id", groupID), url.Param("client", clientID), body.JSON(roles)) |
|||
} |
|||
|
|||
// GetClientsRoleMapping gets client-level role mappings for the user, and the app.
|
|||
func (c *Client) GetClientsRoleMapping(realmName, groupID, clientID string) ([]RoleRepresentation, error) { |
|||
var resp = []RoleRepresentation{} |
|||
var err = c.get(&resp, url.Path(clientRoleMappingPath), url.Param("realm", realmName), url.Param("id", groupID), url.Param("client", clientID)) |
|||
return resp, err |
|||
} |
|||
|
|||
// DeleteClientsRoleMapping deletes client-level roles from user role mapping.
|
|||
func (c *Client) DeleteClientsRoleMapping(realmName, groupID, clientID string) error { |
|||
return c.delete(url.Path(clientRoleMappingPath), url.Param("realm", realmName), url.Param("id", groupID), url.Param("client", clientID)) |
|||
} |
|||
|
|||
Loading…
Reference in new issue