ltsao
6 years agoFrequent Visitor
Using OIDC and Oauth2 in openapi 3
I hope someone can help me. I have been looking at lots of forums and have not been able to find any answers.
I am hoping to use OpenAPI 3 and OIDC to get access token.
I am generating a Java client using codegen cli - java -jar swagger-codegen-cli-3.0.8.jar generate -l java ........
In my yaml I have
securitySchemes: OpenID: type: openIdConnect openIdConnectUrl: https://localhost:9643/oidc/endpoint/jazzop/.well-known/openid-configuration OAuth2: type: oauth2 flows: implicit: authorizationUrl: https://localhost:9643/oidc/endpoint/jazzop/authorize scopes: read: Grants read access write: Grants write access admin: Grants access to admin operations
The generated ApiClient.java contains only
public ApiClient() { httpClient = new OkHttpClient(); verifyingSsl = true; json = new JSON(); // Set default User-Agent. setUserAgent("Swagger-Codegen/1.0.0/java"); // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap<String, Authentication>(); authentications.put("OAuth2", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); }
There is no mention of OpenID. Searching through the generated client, I cannot find any reference to "https://localhost:9643...." anywhere. So even oauth2 "authorization" endpoint is not accessed.
Various forums suggest that oauth2 and oidc happens automagically, but code generated suggests otherwise.
Can someone point me somewhere with more concrete examples of how it works.
Many thanks