1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-04 13:05:23 +02:00

[WIP] Basic LDAP connectivity

This commit is contained in:
sauls8t 2018-08-28 10:19:22 +01:00
parent f28b7497fa
commit 8d3dfcc3c7
72 changed files with 5039 additions and 3548 deletions

View file

@ -64,7 +64,7 @@ func (h *Handler) Sync(w http.ResponseWriter, r *http.Request) {
}
// Exit if not using Keycloak
if org.AuthProvider != "keycloak" {
if org.AuthProvider != ath.AuthProviderKeycloak {
result.Message = "Error: skipping user sync with Keycloak as it is not the configured option"
result.IsError = true
response.WriteJSON(w, result)
@ -73,7 +73,7 @@ func (h *Handler) Sync(w http.ResponseWriter, r *http.Request) {
}
// Make Keycloak auth provider config
c := keycloakConfig{}
c := ath.KeycloakConfig{}
err = json.Unmarshal([]byte(org.AuthConfig), &c)
if err != nil {
result.Message = "Error: unable read Keycloak configuration data"
@ -121,6 +121,7 @@ func (h *Handler) Sync(w http.ResponseWriter, r *http.Request) {
insert = append(insert, k)
}
}
// Track the number of Keycloak users with missing data.
missing := 0
@ -153,7 +154,7 @@ func (h *Handler) Authenticate(w http.ResponseWriter, r *http.Request) {
return
}
a := keycloakAuthRequest{}
a := ath.KeycloakAuthRequest{}
err = json.Unmarshal(body, &a)
if err != nil {
response.WriteBadRequestError(w, method, err.Error())
@ -181,7 +182,7 @@ func (h *Handler) Authenticate(w http.ResponseWriter, r *http.Request) {
ctx.OrgID = org.RefID
// Fetch Keycloak auth provider config
ac := keycloakConfig{}
ac := ath.KeycloakConfig{}
err = json.Unmarshal([]byte(org.AuthConfig), &ac)
if err != nil {
response.WriteBadRequestError(w, method, "Unable to unmarshall Keycloak Public Key")