Skip to content
Snippets Groups Projects
Commit 2a991b7d authored by Nicolas PAGNY's avatar Nicolas PAGNY
Browse files

Deleting the forgotten deleting userserver

parent d26aae68
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,6 @@ import ( ...@@ -9,7 +9,6 @@ import (
"forge.grandlyon.com/npernoud/glcpro/internal/adminserver" "forge.grandlyon.com/npernoud/glcpro/internal/adminserver"
"forge.grandlyon.com/npernoud/glcpro/internal/matcher" "forge.grandlyon.com/npernoud/glcpro/internal/matcher"
"forge.grandlyon.com/npernoud/glcpro/internal/oidcserver" "forge.grandlyon.com/npernoud/glcpro/internal/oidcserver"
"forge.grandlyon.com/npernoud/glcpro/internal/userserver"
"forge.grandlyon.com/npernoud/glcpro/pkg/common" "forge.grandlyon.com/npernoud/glcpro/pkg/common"
"forge.grandlyon.com/npernoud/glcpro/pkg/middlewares" "forge.grandlyon.com/npernoud/glcpro/pkg/middlewares"
"forge.grandlyon.com/npernoud/glcpro/pkg/tokens" "forge.grandlyon.com/npernoud/glcpro/pkg/tokens"
...@@ -27,7 +26,6 @@ func CreateRootMux(staticDir string) *http.ServeMux { ...@@ -27,7 +26,6 @@ func CreateRootMux(staticDir string) *http.ServeMux {
mainMux.Handle("/api/", http.StripPrefix("/api", apiMux)) mainMux.Handle("/api/", http.StripPrefix("/api", apiMux))
mainMux.Handle("/api/oidc/", middlewares.Cors(http.StripPrefix("/api/oidc", oidcserver.CreateOIDCServer()))) mainMux.Handle("/api/oidc/", middlewares.Cors(http.StripPrefix("/api/oidc", oidcserver.CreateOIDCServer())))
mainMux.Handle("/api/matcher/", middlewares.Cors(http.StripPrefix("/api/matcher", matcher.CreateMatcherServer()))) mainMux.Handle("/api/matcher/", middlewares.Cors(http.StripPrefix("/api/matcher", matcher.CreateMatcherServer())))
mainMux.Handle("/api/user/", middlewares.Cors(http.StripPrefix("/api/user", userserver.CreateUserServer())))
allowedRoles := []string{middlewares.AdminRole} allowedRoles := []string{middlewares.AdminRole}
mainMux.Handle("/api/admin/", mainMux.Handle("/api/admin/",
......
package userserver
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"forge.grandlyon.com/npernoud/glcpro/internal/apiuser"
)
func CreateUserServer() *http.ServeMux {
mux := http.NewServeMux()
mux.HandleFunc("/oauth", func(w http.ResponseWriter, r *http.Request) {
readBody, _ := ioutil.ReadAll((r.Body))
query, err := url.ParseQuery(string(readBody))
if err != nil {
http.Error(w, "request body is malformed", http.StatusBadRequest)
}
fmt.Fprintln(os.Stderr, query)
})
mux.HandleFunc("/login", apiuser.Login)
mux.HandleFunc("/logout", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Handler logout OK", http.StatusNotImplemented)
})
//return user data
//TODO put true for xsrfcheck and solve the "authorized" problem
mux.Handle("/whoAmI", apiuser.MiddlewareValidateAuth(apiuser.WhoAmI(), false))
return mux
}
package userserver
import (
"net/http"
"testing"
"forge.grandlyon.com/npernoud/glcpro/pkg/tester"
)
var (
noH map[string]string
)
func TestUserServer(t *testing.T) {
h := CreateUserServer()
do := tester.CreateHandlerTester(t, h)
do("GET", "/login", noH, "", http.StatusNotImplemented, "Handler login OK")
do("GET", "/logout", noH, "", http.StatusNotImplemented, "Handler logout OK")
do("GET", "/whoAmI", noH, "", http.StatusBadRequest, "")
}
//TODO : fix : there is a bug after created a new client (problem with redirect_uri field ?)
// Imports // Imports
import { AnimateCSS, RandomString } from "/services/common/common.js"; import { AnimateCSS, RandomString } from "/services/common/common.js";
import { Delete } from "/services/common/delete.js"; import { Delete } from "/services/common/delete.js";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment