mirror of
https://github.com/documize/community.git
synced 2025-08-04 21:15:24 +02:00
[WIP] Basic LDAP connectivity
This commit is contained in:
parent
f28b7497fa
commit
8d3dfcc3c7
72 changed files with 5039 additions and 3548 deletions
|
@ -28,12 +28,13 @@ import (
|
|||
"github.com/documize/community/domain"
|
||||
usr "github.com/documize/community/domain/user"
|
||||
"github.com/documize/community/model/account"
|
||||
"github.com/documize/community/model/auth"
|
||||
"github.com/documize/community/model/user"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Fetch gets list of Keycloak users for specified Realm, Client Id
|
||||
func Fetch(c keycloakConfig) (users []user.User, err error) {
|
||||
func Fetch(c auth.KeycloakConfig) (users []user.User, err error) {
|
||||
users = []user.User{}
|
||||
|
||||
form := url.Values{}
|
||||
|
@ -71,7 +72,7 @@ func Fetch(c keycloakConfig) (users []user.User, err error) {
|
|||
return users, errors.New("Keycloak authentication failed " + res.Status)
|
||||
}
|
||||
|
||||
ka := keycloakAPIAuth{}
|
||||
ka := auth.KeycloakAPIAuth{}
|
||||
err = json.Unmarshal(body, &ka)
|
||||
if err != nil {
|
||||
return users, err
|
||||
|
@ -114,7 +115,7 @@ func Fetch(c keycloakConfig) (users []user.User, err error) {
|
|||
return users, errors.New("Keycloak users list call failed " + res.Status)
|
||||
}
|
||||
|
||||
kcUsers := []keycloakUser{}
|
||||
kcUsers := []auth.KeycloakUser{}
|
||||
err = json.Unmarshal(body, &kcUsers)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "cannot unmarshal Keycloak user list response")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue