mirror of
https://github.com/documize/community.git
synced 2025-07-19 05:09:42 +02:00
Linting
This commit is contained in:
parent
32dbab826d
commit
4f248bf018
5 changed files with 15 additions and 19 deletions
|
@ -4,6 +4,11 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/documize/community/core/env"
|
"github.com/documize/community/core/env"
|
||||||
"github.com/documize/community/core/response"
|
"github.com/documize/community/core/response"
|
||||||
"github.com/documize/community/core/secrets"
|
"github.com/documize/community/core/secrets"
|
||||||
|
@ -16,10 +21,6 @@ import (
|
||||||
ath "github.com/documize/community/model/auth"
|
ath "github.com/documize/community/model/auth"
|
||||||
"github.com/documize/community/model/user"
|
"github.com/documize/community/model/user"
|
||||||
casv2 "gopkg.in/cas.v2"
|
casv2 "gopkg.in/cas.v2"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Handler contains the runtime information such as logging and database.
|
// Handler contains the runtime information such as logging and database.
|
||||||
|
@ -28,7 +29,6 @@ type Handler struct {
|
||||||
Store *store.Store
|
Store *store.Store
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Authenticate checks CAS authentication credentials.
|
// Authenticate checks CAS authentication credentials.
|
||||||
func (h *Handler) Authenticate(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) Authenticate(w http.ResponseWriter, r *http.Request) {
|
||||||
method := "authenticate"
|
method := "authenticate"
|
||||||
|
@ -63,15 +63,15 @@ func (h *Handler) Authenticate(w http.ResponseWriter, r *http.Request) {
|
||||||
ac := ath.CASConfig{}
|
ac := ath.CASConfig{}
|
||||||
err = json.Unmarshal([]byte(org.AuthConfig), &ac)
|
err = json.Unmarshal([]byte(org.AuthConfig), &ac)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
response.WriteBadRequestError(w, method, "Unable to unmarshall Keycloak Public Key")
|
response.WriteBadRequestError(w, method, "Unable to unmarshal CAS configuration")
|
||||||
h.Runtime.Log.Error(method, err)
|
h.Runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
service := url.QueryEscape(ac.RedirectURL)
|
service := url.QueryEscape(ac.RedirectURL)
|
||||||
|
|
||||||
validateUrl := ac.URL + "/serviceValidate?ticket=" + a.Ticket + "&service="+ service;
|
validateURL := ac.URL + "/serviceValidate?ticket=" + a.Ticket + "&service=" + service
|
||||||
|
|
||||||
resp, err := http.Get(validateUrl)
|
resp, err := http.Get(validateURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
response.WriteBadRequestError(w, method, "Unable to get service validate url")
|
response.WriteBadRequestError(w, method, "Unable to get service validate url")
|
||||||
h.Runtime.Log.Error(method, err)
|
h.Runtime.Log.Error(method, err)
|
||||||
|
|
|
@ -10,10 +10,8 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import { isPresent } from '@ember/utils';
|
import { isPresent } from '@ember/utils';
|
||||||
|
|
||||||
import { reject, resolve } from 'rsvp';
|
import { reject, resolve } from 'rsvp';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
import Base from 'ember-simple-auth/authenticators/base';
|
import Base from 'ember-simple-auth/authenticators/base';
|
||||||
import netUtil from "../utils/net";
|
import netUtil from "../utils/net";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{{layout/logo-heading
|
{{layout/logo-heading
|
||||||
title="Authentication"
|
title="Authentication"
|
||||||
desc="Choose user authentication provider — Documize, Redhat Keycloak, LDAP/AD, CAS"
|
desc="Choose user authentication provider — Documize, Redhat Keycloak, LDAP/AD, Central Authentication Server"
|
||||||
icon=constants.Icon.Locked}}
|
icon=constants.Icon.Locked}}
|
||||||
|
|
||||||
{{customize/auth-settings
|
{{customize/auth-settings
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="option {{if isLDAPProvider "selected"}}" {{action "onLDAP"}}>
|
<li class="option {{if isLDAPProvider "selected"}}" {{action "onLDAP"}}>
|
||||||
<div class="text-header">LDAP</div>
|
<div class="text-header">LDAP</div>
|
||||||
<div class="text">Connect to LDAP/ Active Directory</div>
|
<div class="text">Connect to LDAP/Active Directory</div>
|
||||||
{{#if isLDAPProvider}}
|
{{#if isLDAPProvider}}
|
||||||
<i class="dicon {{constants.Icon.Tick}}" />
|
<i class="dicon {{constants.Icon.Tick}}" />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
<li class="option {{if isCASProvider "selected"}}" {{action "onCAS"}}>
|
<li class="option {{if isCASProvider "selected"}}" {{action "onCAS"}}>
|
||||||
<div class="text-header">CAS</div>
|
<div class="text-header">CAS</div>
|
||||||
<div class="text">Via authentication server</div>
|
<div class="text">Via Central Authentication Server</div>
|
||||||
{{#if isCASProvider}}
|
{{#if isCASProvider}}
|
||||||
<i class="dicon {{constants.Icon.Tick}}" />
|
<i class="dicon {{constants.Icon.Tick}}" />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
package auth
|
package auth
|
||||||
|
|
||||||
|
// CASAuthRequest data received via CAS client library
|
||||||
// CASAuthRequest data received via Keycloak client library
|
|
||||||
type CASAuthRequest struct {
|
type CASAuthRequest struct {
|
||||||
Ticket string `json:"ticket"`
|
Ticket string `json:"ticket"`
|
||||||
Domain string `json:"domain"`
|
Domain string `json:"domain"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// CASConfig server configuration
|
// CASConfig server configuration
|
||||||
type CASConfig struct {
|
type CASConfig struct {
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
RedirectURL string `json"redirectUrl"`
|
RedirectURL string `json"redirectUrl"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue