diff --git a/docker-compose.yml b/docker-compose.yml index 22ba402..58aa585 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,12 +7,14 @@ services: networks: - catalog command: + - "--api.insecure=true" - "--providers.docker=true" - "--providers.docker.exposedbydefault=false" - "--entrypoints.web.address=:80" - "--log.level=DEBUG" ports: - - "8080:80" + - "8080:80" + - "8082:8080" volumes: - /var/run/docker.sock:/var/run/docker.sock whoami: # TEST PURPOSE @@ -24,11 +26,11 @@ services: - "5000:80" labels: - "traefik.enable=true" - - "traefik.http.routers.obg.entrypoints=web" - - "traefik.http.routers.obg.rule=Host(`localhost`)" - - "traefik.http.routers.obg.tls=false" - - "traefik.http.services.obg.loadbalancer.server.port=80" - - "traefik.http.routers.obg.middlewares=oc-auth" + - "traefik.http.routers.whoami.entrypoints=web" + - "traefik.http.routers.whoami.rule=Host(`localhost`)" + - "traefik.http.routers.whoami.tls=false" + - "traefik.http.services.whoami.loadbalancer.server.port=80" + - "traefik.http.routers.whoami.middlewares=auth" oc-auth: image: 'oc-auth:latest' ports: diff --git a/infrastructure/auth_connector/hydra_connector.go b/infrastructure/auth_connector/hydra_connector.go index 12a4793..e1baa73 100644 --- a/infrastructure/auth_connector/hydra_connector.go +++ b/infrastructure/auth_connector/hydra_connector.go @@ -11,6 +11,7 @@ import ( "oc-auth/conf" "oc-auth/infrastructure/claims" "regexp" + "strconv" "strings" oclib "cloud.o-forge.io/core/oc-lib" @@ -174,7 +175,7 @@ func (a HydraConnector) Login(username string, cookies ...*http.Cookie) (t *Toke return nil, err } json.Unmarshal(b, &m) - pp := oclib.Search(nil, string(peer.SELF.EnumIndex()), oclib.LibDataEnum(oclib.PEER)) + pp := oclib.Search(nil, strconv.Itoa(peer.SELF.EnumIndex()), oclib.LibDataEnum(oclib.PEER)) if len(pp.Data) == 0 || pp.Code >= 300 || pp.Err != "" { return nil, errors.New("peer not found") } diff --git a/infrastructure/claims/hydra_claims.go b/infrastructure/claims/hydra_claims.go index afd658c..2879957 100644 --- a/infrastructure/claims/hydra_claims.go +++ b/infrastructure/claims/hydra_claims.go @@ -78,7 +78,7 @@ func (h HydraClaims) DecodeClaimsInToken(host string, method string, forward str for m, p := range claims { splittedP := strings.Split(p.(string), "/") if len(splittedP) != len(splittedPath) { - return false, errors.New("invalid path") + continue } for i, v := range splittedP { if strings.Contains(v, ":") { // is a param