Skip to content

Commit

Permalink
hardcode basic auth for openidconnect internal authentication (#362)
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic authored and labkode committed Nov 8, 2019
1 parent 3d3e9a9 commit ac1b961
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
1 change: 0 additions & 1 deletion examples/separate/frontend.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ userinfo_endpoint = "http://localhost:20080/oauth2/userinfo"
[http.services.oidcprovider]
prefix = "oauth2"
gateway = "localhost:19000"
auth_type = "basic"
issuer = "http://localhost:20080"

[http.services.oidcprovider.clients.phoenix]
Expand Down
4 changes: 1 addition & 3 deletions internal/http/services/oidcprovider/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ func (s *svc) doAuth(w http.ResponseWriter, r *http.Request) {
return
}

// TODO(labkode): this should be a flexible mechanism to
// use any kind of authentication, basic auth, SSO, anything ...
username := r.PostForm.Get("username")
password := r.PostForm.Get("password")
// No username we ask to give one, here we provide only a form validation.
Expand Down Expand Up @@ -92,7 +90,7 @@ func (s *svc) doAuth(w http.ResponseWriter, r *http.Request) {
}

genReq := &gatewayv0alphapb.AuthenticateRequest{
Type: s.conf.AuthType,
Type: "basic", // we are sending username and password -> basic auth
ClientId: username,
ClientSecret: password,
}
Expand Down
5 changes: 0 additions & 5 deletions internal/http/services/oidcprovider/oidcprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package oidcprovider
import (
"crypto/rand"
"crypto/rsa"
"fmt"
"net/http"
"time"

Expand All @@ -44,7 +43,6 @@ func init() {

type config struct {
Prefix string `mapstructure:"prefix"`
AuthType string `mapstructure:"auth_type"`
GatewayEndpoint string `mapstructure:"gateway"`
Clients map[string]map[string]interface{} `mapstructure:"clients"`
Issuer string `mapstructure:"issuer"`
Expand Down Expand Up @@ -81,9 +79,6 @@ func New(m map[string]interface{}) (rhttp.Service, error) {
c.Prefix = "oauth2"
}

if c.AuthType == "" {
return nil, fmt.Errorf("oidcprovidersvc: auth_type cannot be empty")
}
// parse clients
clients := map[string]fosite.Client{}
for id, val := range c.Clients {
Expand Down

0 comments on commit ac1b961

Please sign in to comment.