Copy to ClipboardCopied!Toggle word wrapToggle overflow
Here we have setup two security definitions
OAuth2 - with implicit authorization with the provided url
Api Key - using an api key that comes from HTTP header named myHeader
Then you need to specify on the rest operations which security to use by referring to their key (petstore_auth or api_key).
.get("/{id}/{date}").description("Find user by id and date").outType(User.class)
.security("api_key")
...
.put().description("Updates or create a user").type(User.class)
.security("petstore_auth", "write:pets,read:pets")
.get("/{id}/{date}").description("Find user by id and date").outType(User.class)
.security("api_key")
...
.put().description("Updates or create a user").type(User.class)
.security("petstore_auth", "write:pets,read:pets")
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Here the get operation is using the Api Key security and the put operation is using OAuth security with permitted scopes of read and write pets.
We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.
Making open source more inclusive
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.
About Red Hat
We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.