mirror of
https://github.com/documize/community.git
synced 2025-07-23 15:19:42 +02:00
removed rogue pkg reference!
This commit is contained in:
parent
5acfae3d0d
commit
7756a50d64
2 changed files with 16 additions and 4 deletions
|
@ -20,7 +20,6 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"obiwan/utility"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -82,7 +81,7 @@ func AuthenticateKeycloak(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode and prepare RSA Public Key used by keycloak to sign JWT.
|
// Decode and prepare RSA Public Key used by keycloak to sign JWT.
|
||||||
pkb, err := utility.DecodeBase64([]byte(ac.PublicKey))
|
pkb, err := decodeBase64([]byte(ac.PublicKey))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeBadRequestError(w, method, "Unable to base64 decode Keycloak Public Key")
|
writeBadRequestError(w, method, "Unable to base64 decode Keycloak Public Key")
|
||||||
return
|
return
|
||||||
|
|
|
@ -13,12 +13,12 @@ package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"obiwan/utility"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ func AddUser(w http.ResponseWriter, r *http.Request) {
|
||||||
if addUser && addAccount {
|
if addUser && addAccount {
|
||||||
size := len(requestedPassword)
|
size := len(requestedPassword)
|
||||||
auth := fmt.Sprintf("%s:%s:%s", p.Context.AppURL, userModel.Email, requestedPassword[:size])
|
auth := fmt.Sprintf("%s:%s:%s", p.Context.AppURL, userModel.Email, requestedPassword[:size])
|
||||||
encrypted := utility.EncodeBase64([]byte(auth))
|
encrypted := encodeBase64([]byte(auth))
|
||||||
|
|
||||||
url := fmt.Sprintf("%s/%s", p.Context.GetAppURL("auth/sso"), url.QueryEscape(string(encrypted)))
|
url := fmt.Sprintf("%s/%s", p.Context.GetAppURL("auth/sso"), url.QueryEscape(string(encrypted)))
|
||||||
go mail.InviteNewUser(userModel.Email, inviter.Fullname(), url, userModel.Email, requestedPassword)
|
go mail.InviteNewUser(userModel.Email, inviter.Fullname(), url, userModel.Email, requestedPassword)
|
||||||
|
@ -764,3 +764,16 @@ func writeUsers(w http.ResponseWriter, u []entity.User) {
|
||||||
|
|
||||||
writeSuccessBytes(w, j)
|
writeSuccessBytes(w, j)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func encodeBase64(b []byte) []byte {
|
||||||
|
return []byte(base64.StdEncoding.EncodeToString(b))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func decodeBase64(b []byte) ([]byte, error) {
|
||||||
|
data, err := base64.StdEncoding.DecodeString(string(b))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return data, nil
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue