Skip to content

Commit

Permalink
allow from ui header
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Dec 8, 2023
1 parent 5019ee7 commit 8e3853a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func HandleRESTRequests(wg *sync.WaitGroup, ctx context.Context) {

// Currently allowed dev origin is all. Should change in prod
// should consider analyzing the allowed methods further
headersOk := handlers.AllowedHeaders([]string{"Access-Control-Allow-Origin", "X-Requested-With", "Content-Type", "authorization", "From-UI"})
headersOk := handlers.AllowedHeaders([]string{"Access-Control-Allow-Origin", "X-Requested-With", "Content-Type", "authorization", "From-Ui"})
originsOk := handlers.AllowedOrigins(strings.Split(servercfg.GetAllowedOrigin(), ","))
methodsOk := handlers.AllowedMethods([]string{http.MethodGet, http.MethodPut, http.MethodPost, http.MethodDelete})

Expand Down
2 changes: 1 addition & 1 deletion controllers/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func authenticateUser(response http.ResponseWriter, request *http.Request) {
return
}

if val := request.Header.Get("From-UI"); val == "true" {
if val := request.Header.Get("From-Ui"); val == "true" {
// request came from UI, if normal user block Login
user, err := logic.GetUser(authRequest.UserName)
if err != nil {
Expand Down

0 comments on commit 8e3853a

Please sign in to comment.