io.swagger.v3.oas.annotations.security.SecurityRequirement Java Examples
The following examples show how to use
io.swagger.v3.oas.annotations.security.SecurityRequirement.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccessTokenService.java From syncope with Apache License 2.0 | 6 votes |
/** * Returns an empty response bearing the X-Syncope-Token header value, with extended lifetime. * The provided value is a signed JSON Web Token. * * @return an empty response bearing the X-Syncope-Token header value, with extended lifetime */ @Operation(security = { @SecurityRequirement(name = "Bearer") }) @ApiResponses( @ApiResponse(responseCode = "204", description = "JWT successfully refreshed", headers = { @Header(name = RESTHeaders.TOKEN, schema = @Schema(type = "string"), description = "Generated JWT"), @Header(name = RESTHeaders.TOKEN_EXPIRE, schema = @Schema(type = "string"), description = "Expiration of the refreshed JWT") })) @POST @Path("refresh") @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) Response refresh();
Example #2
Source File: AccessTokenService.java From syncope with Apache License 2.0 | 6 votes |
/** * Returns an empty response bearing the X-Syncope-Token header value, in case of successful authentication. * The provided value is a signed JSON Web Token. * * @return empty response bearing the X-Syncope-Token header value, in case of successful authentication */ @Operation(security = { @SecurityRequirement(name = "BasicAuthentication") }) @ApiResponses({ @ApiResponse(responseCode = "204", description = "JWT successfully generated", headers = { @Header(name = RESTHeaders.TOKEN, schema = @Schema(type = "string"), description = "Generated JWT"), @Header(name = RESTHeaders.TOKEN_EXPIRE, schema = @Schema(type = "string"), description = "Expiration of the generated JWT") }), @ApiResponse(responseCode = "401", description = "Invalid username or password") }) @POST @Path("login") @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) Response login();
Example #3
Source File: SecurityService.java From lagom-openapi with Apache License 2.0 | 6 votes |
@Operation( responses = { @ApiResponse( description = "test description", content = @Content( mediaType = "application/json", schema = @Schema(implementation = String.class) ) ) }, operationId = "Operation Id", description = "description" ) @SecurityRequirement( name = "security_key", scopes = {"write:pets", "generate:pets"} ) ServiceCall<String, NotUsed> test1();
Example #4
Source File: SecurityService.java From lagom-openapi with Apache License 2.0 | 6 votes |
@Operation( responses = { @ApiResponse( description = "test description", content = @Content( mediaType = "application/json", schema = @Schema(implementation = String.class) ) ) }, operationId = "Operation Id 2", description = "description 2" ) @SecurityRequirement( name = "security_key2", scopes = {"write:pets", "generate:pets"} ) ServiceCall<String, NotUsed> test2();
Example #5
Source File: UserSelfService.java From syncope with Apache License 2.0 | 6 votes |
/** * Returns the user making the service call. * * @return calling user data, including own UUID and entitlements */ @Operation(security = { @SecurityRequirement(name = "BasicAuthentication"), @SecurityRequirement(name = "Bearer") }) @ApiResponses( @ApiResponse(responseCode = "200", description = "Calling user data, including own UUID and entitlements", content = @Content(schema = @Schema(implementation = UserTO.class)), headers = { @Header(name = RESTHeaders.RESOURCE_KEY, schema = @Schema(type = "string"), description = "UUID of the calling user"), @Header(name = RESTHeaders.OWNED_ENTITLEMENTS, schema = @Schema(type = "string"), description = "List of entitlements owned by the calling user") })) @GET @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) Response read();
Example #6
Source File: UserSelfService.java From syncope with Apache License 2.0 | 5 votes |
/** * Self-updates user. * * @param user complete update * @return Response object featuring the updated user */ @Operation(security = { @SecurityRequirement(name = "BasicAuthentication"), @SecurityRequirement(name = "Bearer") }) @Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER, description = "Allows client to specify a preference for the result to be returned from the server", allowEmptyValue = true, schema = @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" })) @Parameter(name = "key", description = "User's key", in = ParameterIn.PATH, schema = @Schema(type = "string")) @ApiResponses({ @ApiResponse(responseCode = "200", description = "User successfully updated enriched with propagation status information, as Entity", content = @Content(schema = @Schema(implementation = ProvisioningResult.class))), @ApiResponse(responseCode = "204", description = "No content if 'Prefer: return-no-content' was specified", headers = @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema = @Schema(type = "string"), description = "Allows the server to inform the " + "client about the fact that a specified preference was applied")) }) @PUT @Path("{key}") @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) Response update(@NotNull UserTO user);
Example #7
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Update an existing pet", description = "", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @ApiResponse(responseCode = "404", description = "Pet not found"), @ApiResponse(responseCode = "405", description = "Validation exception") }) @PutMapping(value = "/pet", consumes = { "application/json", "application/xml" }) default ResponseEntity<Void> updatePet( @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet) { return getDelegate().updatePet(pet); }
Example #8
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "uploads an image", description = "", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = ModelApiResponse.class))) }) @PostMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }) default ResponseEntity<ModelApiResponse> uploadFile( @Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, @Parameter(description = "file detail") @Valid @RequestPart("file") MultipartFile file) { return getDelegate().uploadFile(petId, additionalMetadata, file); }
Example #9
Source File: StoreApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Returns pet inventories by status", description = "Returns a map of status codes to quantities", security = { @SecurityRequirement(name = "api_key") }, tags = { "store" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Map.class)))) }) @GetMapping(value = "/store/inventory", produces = { "application/json" }) default ResponseEntity<Map<String, Integer>> getInventory() { return getDelegate().getInventory(); }
Example #10
Source File: OpenAPITests.java From proteus with Apache License 2.0 | 5 votes |
@GET @SecurityRequirement(name = "testRequirement") @Path("secure/resource") @Operation(description="Secure resource") @Produces(MediaType.APPLICATION_JSON) public ServerResponse<Map<String,Object>> responseSecureContext() { Map<String,Object> responseMap = new HashMap<>(); responseMap.put("secure",true); return response(responseMap); }
Example #11
Source File: UserSelfService.java From syncope with Apache License 2.0 | 5 votes |
/** * Self-updates user. * * @param updateReq modification to be applied to self * @return Response object featuring the updated user */ @Operation(security = { @SecurityRequirement(name = "BasicAuthentication"), @SecurityRequirement(name = "Bearer") }) @Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER, description = "Allows client to specify a preference for the result to be returned from the server", allowEmptyValue = true, schema = @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" })) @Parameter(name = "key", description = "User's key", in = ParameterIn.PATH, schema = @Schema(type = "string")) @ApiResponses({ @ApiResponse(responseCode = "200", description = "User successfully updated enriched with propagation status information, as Entity", content = @Content(schema = @Schema(implementation = ProvisioningResult.class))), @ApiResponse(responseCode = "204", description = "No content if 'Prefer: return-no-content' was specified", headers = @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema = @Schema(type = "string"), description = "Allows the server to inform the " + "client about the fact that a specified preference was applied")) }) @PATCH @Path("{key}") @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) Response update(@NotNull UserUR updateReq);
Example #12
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Deletes a pet", description = "", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @ApiResponse(responseCode = "404", description = "Pet not found") }) @DeleteMapping(value = "/pet/{petId}") default ResponseEntity<Void> deletePet( @Parameter(description = "Pet id to delete", required = true) @PathVariable("petId") Long petId, @Parameter(description = "") @RequestHeader(value = "api_key", required = false) String apiKey) { return getDelegate().deletePet(petId, apiKey); }
Example #13
Source File: UserSelfService.java From syncope with Apache License 2.0 | 5 votes |
/** * Self-perform a status update. * * @param statusR status update details * @return Response object featuring the updated user enriched with propagation status information */ @Operation(security = { @SecurityRequirement(name = "BasicAuthentication"), @SecurityRequirement(name = "Bearer") }) @Parameter(name = RESTHeaders.PREFER, in = ParameterIn.HEADER, description = "Allows client to specify a preference for the result to be returned from the server", allowEmptyValue = true, schema = @Schema(defaultValue = "return-content", allowableValues = { "return-content", "return-no-content" })) @Parameter(name = "key", description = "User's key", in = ParameterIn.PATH, schema = @Schema(type = "string")) @ApiResponses({ @ApiResponse(responseCode = "200", description = "User successfully updated enriched with propagation status information, as Entity", content = @Content(schema = @Schema(implementation = ProvisioningResult.class))), @ApiResponse(responseCode = "204", description = "No content if 'Prefer: return-no-content' was specified", headers = @Header(name = RESTHeaders.PREFERENCE_APPLIED, schema = @Schema(type = "string"), description = "Allows the server to inform the " + "client about the fact that a specified preference was applied")) }) @POST @Path("{key}/status") @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) Response status(@NotNull StatusR statusR);
Example #14
Source File: UserSelfService.java From syncope with Apache License 2.0 | 5 votes |
/** * Self-deletes user. * * @return Response object featuring the deleted user */ @Operation(security = { @SecurityRequirement(name = "BasicAuthentication"), @SecurityRequirement(name = "Bearer") }) @DELETE @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) Response delete();
Example #15
Source File: UserSelfService.java From syncope with Apache License 2.0 | 5 votes |
/** * Changes own password when change was forced by an administrator. * * @param password the password value to update * * @return Response object featuring the updated user */ @Operation(security = { @SecurityRequirement(name = "BasicAuthentication"), @SecurityRequirement(name = "Bearer") }) @POST @Path("mustChangePassword") @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) Response mustChangePassword(String password);
Example #16
Source File: AccessTokenService.java From syncope with Apache License 2.0 | 5 votes |
/** * Invalidates the access token of the requesting user. */ @Operation(security = { @SecurityRequirement(name = "Bearer") }) @ApiResponses( @ApiResponse(responseCode = "204", description = "Operation was successful")) @POST @Path("logout") @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) void logout();
Example #17
Source File: AccessTokenService.java From syncope with Apache License 2.0 | 5 votes |
/** * Returns a paged list of existing access tokens matching the given query. * * @param query query conditions * @return paged list of existing access tokens matching the given query */ @Operation(security = { @SecurityRequirement(name = "BasicAuthentication"), @SecurityRequirement(name = "Bearer") }) @GET @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) PagedResult<AccessTokenTO> list(@BeanParam AccessTokenQuery query);
Example #18
Source File: AccessTokenService.java From syncope with Apache License 2.0 | 5 votes |
/** * Invalidates the access token matching the provided key. * * @param key access token key */ @Operation(security = { @SecurityRequirement(name = "BasicAuthentication"), @SecurityRequirement(name = "Bearer") }) @ApiResponses( @ApiResponse(responseCode = "204", description = "Operation was successful")) @DELETE @Path("{key}") @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML }) void delete(@PathParam("key") String key);
Example #19
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Finds Pets by status", description = "Multiple status values can be provided with comma separated strings", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))), @ApiResponse(responseCode = "400", description = "Invalid status value") }) @GetMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }) default ResponseEntity<List<Pet>> findPetsByStatus( @NotNull @Parameter(description = "Status values that need to be considered for filter", required = true) @Valid @RequestParam(value = "status", required = true) List<String> status) { return getDelegate().findPetsByStatus(status); }
Example #20
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Add a new pet to the store", description = "", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "405", description = "Invalid input") }) @PostMapping(value = "/pet", consumes = { "application/json", "application/xml" }) default void addPet( @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet) { // return getDelegate().addPet(pet); }
Example #21
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Finds Pets by status", description = "Multiple status values can be provided with comma separated strings", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))), @ApiResponse(responseCode = "400", description = "Invalid status value") }) @GetMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }) default ResponseEntity<List<Pet>> findPetsByStatus( @NotNull @Parameter(description = "Status values that need to be considered for filter", required = true) @Valid @RequestParam(value = "status", required = true) List<String> status) { return getDelegate().findPetsByStatus(status); }
Example #22
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Find pet by ID", description = "Returns a single pet", security = { @SecurityRequirement(name = "api_key") }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Pet.class))), @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @ApiResponse(responseCode = "404", description = "Pet not found") }) @GetMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }) default ResponseEntity<Pet> getPetById( @Parameter(description = "ID of pet to return", required = true) @PathVariable("petId") Long petId) { return getDelegate().getPetById(petId); }
Example #23
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Update an existing pet", description = "", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @ApiResponse(responseCode = "404", description = "Pet not found"), @ApiResponse(responseCode = "405", description = "Validation exception") }) @PutMapping(value = "/pet", consumes = { "application/json", "application/xml" }) default ResponseEntity<Void> updatePet( @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet) { return getDelegate().updatePet(pet); }
Example #24
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "uploads an image", description = "", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = ModelApiResponse.class))) }) @PostMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }) default ResponseEntity<ModelApiResponse> uploadFile( @Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, @Parameter(description = "file detail") @Valid @RequestPart("file") MultipartFile file) { return getDelegate().uploadFile(petId, additionalMetadata, file); }
Example #25
Source File: StoreApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Returns pet inventories by status", description = "Returns a map of status codes to quantities", security = { @SecurityRequirement(name = "api_key") }, tags = { "store" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Map.class)))) }) @GetMapping(value = "/store/inventory", produces = { "application/json" }) default ResponseEntity<Map<String, Integer>> getInventory() { return getDelegate().getInventory(); }
Example #26
Source File: StoreApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Returns pet inventories by status", description = "Returns a map of status codes to quantities", security = { @SecurityRequirement(name = "api_key") }, tags = { "store" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Map.class)))) }) @GetMapping(value = "/store/inventory", produces = { "application/json" }) @ResponseBody default ResponseEntity<Map<String, Integer>> getInventory() { return getDelegate().getInventory(); }
Example #27
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Add a new pet to the store", description = "", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "405", description = "Invalid input") }) @PostMapping(value = "/pet", consumes = { "application/json", "application/xml" }) default void addPet( @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet) { // return getDelegate().addPet(pet); }
Example #28
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Deletes a pet", description = "", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @ApiResponse(responseCode = "404", description = "Pet not found") }) @DeleteMapping(value = "/pet/{petId}") default ResponseEntity<Void> deletePet( @Parameter(description = "Pet id to delete", required = true) @PathVariable("petId") Long petId, @Parameter(description = "") @RequestHeader(value = "api_key", required = false) String apiKey) { return getDelegate().deletePet(petId, apiKey); }
Example #29
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Finds Pets by status", description = "Multiple status values can be provided with comma separated strings", security = { @SecurityRequirement(name = "petstore_auth", scopes = { "write:pets", "read:pets" }) }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))), @ApiResponse(responseCode = "400", description = "Invalid status value") }) @GetMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }) default ResponseEntity<List<Pet>> findPetsByStatus( @NotNull @Parameter(description = "Status values that need to be considered for filter", required = true) @Valid @RequestParam(value = "status", required = true) List<String> status) { return getDelegate().findPetsByStatus(status); }
Example #30
Source File: PetApi.java From springdoc-openapi with Apache License 2.0 | 5 votes |
@Operation(summary = "Find pet by ID", description = "Returns a single pet", security = { @SecurityRequirement(name = "api_key") }, tags = { "pet" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Pet.class))), @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @ApiResponse(responseCode = "404", description = "Pet not found") }) @GetMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }) default ResponseEntity<Pet> getPetById( @Parameter(description = "ID of pet to return", required = true) @PathVariable("petId") Long petId) { return getDelegate().getPetById(petId); }