-
Notifications
You must be signed in to change notification settings - Fork 29
Invalid discoveryUrl Causes Confusing Too Many Redirects Error #43
Comments
Change You should probably also remove |
@k3a I changes kind: Policy
metadata:
name: samplepolicy
spec:
targets:
-
serviceName: httpbin
paths:
- prefix: /
method: ALL
policies:
- policyType: oidc
config: oidc-provider-config |
That's odd. I basically use the following basic config which works for me. It even uses Also check the logs And you can also use "Persist logs" in the browser developer tools and watch the redirection flow to see why it redirects and to which URLs. It is also possible to increase logging verbosity. See the logging section of Helm values.yaml. apiVersion: "security.cloud.ibm.com/v1"
kind: OidcConfig
metadata:
name: oidc-provider-config
namespace: default
spec:
authMethod: client_secret_basic
discoveryUrl: https://DOMAIN/.well-known/openid-configuration
clientId: CLIENT_ID
clientSecret: CLIENT_SECRET
---
apiVersion: "security.cloud.ibm.com/v1"
kind: Policy
metadata:
name: httpbin
namespace: default
spec:
targets:
- serviceName: httpbin
paths:
- method: ALL
policies:
- policyType: oidc
config: oidc-provider-config
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpbin
spec:
selector:
matchLabels:
app: httpbin
template:
metadata:
labels:
app: httpbin
spec:
containers:
- name: httpbin
image: kennethreitz/httpbin:latest
resources:
limits:
memory: "228Mi"
cpu: "500m"
ports:
- containerPort: 80
---
kind: Service
apiVersion: v1
metadata:
name: httpbin
spec:
selector:
app: httpbin
ports:
- name: http
port: 80
targetPort: 80
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: httpbin
spec:
hosts:
- "*"
gateways:
- bookinfo-gateway
http:
- match:
- uri:
prefix: /httpbin
rewrite:
uri: /
route:
- destination:
host: httpbin
port:
number: 80
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: httpbin
spec:
host: httpbin
trafficPolicy:
tls:
mode: DISABLE
|
@k3a I ran into the same issue with your configuration, so I enabled Fixing the
where CLIENT_ID is my app's OIDC client id.
// When I create the OidcConfig
{
"level": "debug",
"ts": "2020-02-09t21:08:20.148z",
"caller": "authserver/authserver.go:77",
"msg": "initialization from discovery endpoint failed. will retry later.",
"source": "appidentityandaccessadapter-adapter",
"url": "OKTA_URL"
}
{
"level": "debug",
"ts": "2020-02-09t21:08:20.230z",
"caller": "authserver/authserver.go:206",
"msg": "could not sync discovery endpoint",
"source": "appidentityandaccessadapter-adapter",
"url": "OKTA_URL",
"error": "invalid discovery config: missing `userinfo_endpoint`"
}
// When I make a request
{
"level": "debug",
"ts": "2020-02-09T21:10:14.736Z",
"caller": "engine/engine.go:68",
"msg": "Checking policies",
"source": "appidentityandaccessadapter-adapter",
"count": 1
}
{
"level": "info",
"ts": "2020-02-09T21:10:14.736Z",
"caller": "adapter/adapter.go:71",
"msg": "Executing OIDC policies",
"source": "appidentityandaccessadapter-adapter"
}
{
"level": "debug",
"ts": "2020-02-09T21:10:14.736Z",
"caller": "web/web.go:149",
"msg": "Tokens not found in cache.",
"source": "appidentityandaccessadapter-adapter",
"client_name": "default/oidc-provider-config"
}
{
"level": "debug",
"ts": "2020-02-09T21:10:14.736Z",
"caller": "web/web.go:123",
"msg": "Handling new user authentication",
"source": "appidentityandaccessadapter-adapter"
}
{
"level": "debug",
"ts": "2020-02-09T21:10:14.736Z",
"caller": "web/web.go:335",
"msg": "Initiating redirect to identity provider using redirect URL: http://192.168.64.3:30418/httpbin/headers/oidc/callback",
"source": "appidentityandaccessadapter-adapter"
}
{
"level": "debug",
"ts": "2020-02-09T21:10:14.805Z",
"caller": "authserver/authserver.go:206",
"msg": "Could not sync discovery endpoint",
"source": "appidentityandaccessadapter-adapter",
"url": "OKTA_URL",
"error": "invalid discovery config: missing `userinfo_endpoint`"
}
{
"level": "debug",
"ts": "2020-02-09T21:10:14.805Z",
"caller": "authserver/authserver.go:187",
"msg": "Could not sync discovery endpoint",
"source": "appidentityandaccessadapter-adapter",
"url": "OKTA_URL",
"error": "invalid discovery config: missing `userinfo_endpoint`"
} |
@k3a Narrowed down Okta access token validation error. The default JWT validation rules for OIDC checks for the client id in the // createDefaultRules generates the default JWT validation rules for the given client
func createDefaultRules(action Action) []v1.Rule {
switch action.Type {
case policy.OIDC:
return []v1.Rule{
{
Claim: aud,
Match: "ANY",
Values: []string{action.Client.ID()},
},
}
default:
return []v1.Rule{}
}
} |
It is a default rule if no rule is specified. Try to append your own rule(s):
Although I found out this adapter is pre-release. There are couple of things which needs fixing to make it work well-enough. Overall, it's written quite well so not much is remaining. I will try to fix some issues by sending more pull requests soon... |
@k3a Thanks! I'm happy to contribute as well if you need help! |
@k3a The aud issue still exists even after I set policy rules. I have tried multiple different types of configuration of the rules, but it still continues to use the default rules. |
We are evaluating the
app-identity-and-access-adapter
and I am trying to deploy it to Minkube to test it out; however, I am getting an infinite redirect loop at the implicit/oidc/callback
endpoint (ERR_TOO_MANY_REDIRECTS
). I imagine the adapter is not intercepting the request correctly. Any idea what could be going wrong? Is this a configuration issue or an issue specific to Minikube? See my manifests below.I am using the latest Minikube and Istio versions.
The text was updated successfully, but these errors were encountered: