mirror of
https://github.com/documize/community.git
synced 2025-07-22 22:59:43 +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"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"obiwan/utility"
|
||||
"sort"
|
||||
"strconv"
|
||||
"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.
|
||||
pkb, err := utility.DecodeBase64([]byte(ac.PublicKey))
|
||||
pkb, err := decodeBase64([]byte(ac.PublicKey))
|
||||
if err != nil {
|
||||
writeBadRequestError(w, method, "Unable to base64 decode Keycloak Public Key")
|
||||
return
|
||||
|
|
|
@ -13,12 +13,12 @@ package endpoint
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"obiwan/utility"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
@ -192,7 +192,7 @@ func AddUser(w http.ResponseWriter, r *http.Request) {
|
|||
if addUser && addAccount {
|
||||
size := len(requestedPassword)
|
||||
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)))
|
||||
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)
|
||||
}
|
||||
|
||||
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