Hithomelabs/CFTunnels#115: Replace non-standard @security/@response with @throws
This commit is contained in:
parent
4460e86776
commit
d728504aad
@ -110,9 +110,7 @@ public class TunnelController implements ErrorController {
|
|||||||
*
|
*
|
||||||
* @param oidcUser The authenticated OIDC user
|
* @param oidcUser The authenticated OIDC user
|
||||||
* @return Map containing username and roles
|
* @return Map containing username and roles
|
||||||
*
|
* @throws SecurityException if authentication fails
|
||||||
* @security Requires USER role
|
|
||||||
* @response 200 OK
|
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAnyRole('USER')")
|
@PreAuthorize("hasAnyRole('USER')")
|
||||||
@GetMapping("/whoami")
|
@GetMapping("/whoami")
|
||||||
@ -134,10 +132,7 @@ public class TunnelController implements ErrorController {
|
|||||||
* including their status and configuration from the Cloudflare API.</p>
|
* including their status and configuration from the Cloudflare API.</p>
|
||||||
*
|
*
|
||||||
* @return Map containing list of all tunnels
|
* @return Map containing list of all tunnels
|
||||||
*
|
* @throws SecurityException if user lacks required role
|
||||||
* @security Requires USER role
|
|
||||||
* @response 200 OK with tunnel list
|
|
||||||
* @response 500 Internal Server Error if API call fails
|
|
||||||
* @see <a href="https://api.cloudflare.com/#cfd_tunnel-get-tunnels">Cloudflare API</a>
|
* @see <a href="https://api.cloudflare.com/#cfd_tunnel-get-tunnels">Cloudflare API</a>
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAnyRole('USER')")
|
@PreAuthorize("hasAnyRole('USER')")
|
||||||
@ -160,10 +155,7 @@ public class TunnelController implements ErrorController {
|
|||||||
* with environment associations.</p>
|
* with environment associations.</p>
|
||||||
*
|
*
|
||||||
* @return Map containing list of configured tunnels
|
* @return Map containing list of configured tunnels
|
||||||
*
|
* @throws SecurityException if user lacks required role
|
||||||
* @security Requires USER role
|
|
||||||
* @response 200 OK with tunnel list
|
|
||||||
* @response 500 Internal Server Error if database access fails
|
|
||||||
* @see CloudflareAPIService#getAllConfiguredTunnels()
|
* @see CloudflareAPIService#getAllConfiguredTunnels()
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAnyRole('USER')")
|
@PreAuthorize("hasAnyRole('USER')")
|
||||||
@ -186,10 +178,7 @@ public class TunnelController implements ErrorController {
|
|||||||
* <p>Returns all pending, approved, and rejected mapping requests.</p>
|
* <p>Returns all pending, approved, and rejected mapping requests.</p>
|
||||||
*
|
*
|
||||||
* @return Map containing list of all requests
|
* @return Map containing list of all requests
|
||||||
*
|
* @throws SecurityException if user lacks required role
|
||||||
* @security Requires USER role
|
|
||||||
* @response 200 OK with request list
|
|
||||||
* @response 500 Internal Server Error if database access fails
|
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAnyRole('USER')")
|
@PreAuthorize("hasAnyRole('USER')")
|
||||||
@GetMapping("/requests")
|
@GetMapping("/requests")
|
||||||
@ -213,10 +202,7 @@ public class TunnelController implements ErrorController {
|
|||||||
*
|
*
|
||||||
* @param tunnelId The Cloudflare tunnel ID (UUID)
|
* @param tunnelId The Cloudflare tunnel ID (UUID)
|
||||||
* @return Map containing tunnel configuration
|
* @return Map containing tunnel configuration
|
||||||
*
|
* @throws SecurityException if user lacks required role
|
||||||
* @security Requires DEVELOPER role
|
|
||||||
* @response 200 OK with configuration
|
|
||||||
* @response 500 Internal Server Error
|
|
||||||
* @see <a href="https://api.cloudflare.com/#cfd_tunnel-get-tunnel-config">Cloudflare API</a>
|
* @see <a href="https://api.cloudflare.com/#cfd_tunnel-get-tunnel-config">Cloudflare API</a>
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAnyRole('DEVELOPER')")
|
@PreAuthorize("hasAnyRole('DEVELOPER')")
|
||||||
@ -241,11 +227,8 @@ public class TunnelController implements ErrorController {
|
|||||||
* @param tunnelId The Cloudflare tunnel ID (UUID)
|
* @param tunnelId The Cloudflare tunnel ID (UUID)
|
||||||
* @param ingress The ingress rule to add
|
* @param ingress The ingress rule to add
|
||||||
* @return Map containing the updated configuration
|
* @return Map containing the updated configuration
|
||||||
*
|
* @throws SecurityException if user lacks required role
|
||||||
* @security Requires ADMIN role
|
* @throws JsonProcessingException if JSON processing fails
|
||||||
* @response 200 OK with updated configuration
|
|
||||||
* @response 400 Bad Request if ingress is invalid
|
|
||||||
* @response 500 Internal Server Error
|
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* {
|
* {
|
||||||
@ -284,10 +267,8 @@ public class TunnelController implements ErrorController {
|
|||||||
* @param tunnelId The Cloudflare tunnel ID (UUID)
|
* @param tunnelId The Cloudflare tunnel ID (UUID)
|
||||||
* @param ingress Ingress containing hostname to delete (only hostname field is used)
|
* @param ingress Ingress containing hostname to delete (only hostname field is used)
|
||||||
* @return Map containing the result
|
* @return Map containing the result
|
||||||
*
|
* @throws SecurityException if user lacks required role
|
||||||
* @security Requires DEVELOPER role
|
* @throws JsonProcessingException if JSON processing fails
|
||||||
* @response 200 OK with updated configuration
|
|
||||||
* @response 409 Conflict if hostname not found
|
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAnyRole('DEVELOPER')")
|
@PreAuthorize("hasAnyRole('DEVELOPER')")
|
||||||
@DeleteMapping("/tunnels/{tunnelId}/mappings")
|
@DeleteMapping("/tunnels/{tunnelId}/mappings")
|
||||||
@ -329,11 +310,7 @@ public class TunnelController implements ErrorController {
|
|||||||
* @param oidcUser The authenticated user
|
* @param oidcUser The authenticated user
|
||||||
* @param ingess The ingress configuration to request
|
* @param ingess The ingress configuration to request
|
||||||
* @return The created request with PENDING status
|
* @return The created request with PENDING status
|
||||||
*
|
* @throws SecurityException if user lacks required role
|
||||||
* @security Requires DEVELOPER role
|
|
||||||
* @response 201 Created with request
|
|
||||||
* @response 400 Bad Request if invalid
|
|
||||||
*
|
|
||||||
* @see MappingRequestService#createMappingRequest(String, Ingress, OidcUser)
|
* @see MappingRequestService#createMappingRequest(String, Ingress, OidcUser)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAnyRole('DEVELOPER')")
|
@PreAuthorize("hasAnyRole('DEVELOPER')")
|
||||||
@ -354,11 +331,7 @@ public class TunnelController implements ErrorController {
|
|||||||
* @param requestId The ID of the request to approve
|
* @param requestId The ID of the request to approve
|
||||||
* @param oidcUser The approver (must have APPROVER role)
|
* @param oidcUser The approver (must have APPROVER role)
|
||||||
* @return The updated request with APPROVED status
|
* @return The updated request with APPROVED status
|
||||||
*
|
* @throws SecurityException if user lacks required role
|
||||||
* @security Requires APPROVER role
|
|
||||||
* @response 200 OK with approved request
|
|
||||||
* @response 404 Not Found if request doesn't exist
|
|
||||||
* @response 409 Conflict if request already processed
|
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAnyRole('APPROVER')")
|
@PreAuthorize("hasAnyRole('APPROVER')")
|
||||||
@PutMapping("/requests/{requestId}/approve")
|
@PutMapping("/requests/{requestId}/approve")
|
||||||
@ -386,11 +359,7 @@ public class TunnelController implements ErrorController {
|
|||||||
* @param requestId The ID of the request to reject
|
* @param requestId The ID of the request to reject
|
||||||
* @param oidcUser The rejecter (must have APPROVER role)
|
* @param oidcUser The rejecter (must have APPROVER role)
|
||||||
* @return The updated request with REJECTED status
|
* @return The updated request with REJECTED status
|
||||||
*
|
* @throws SecurityException if user lacks required role
|
||||||
* @security Requires APPROVER role
|
|
||||||
* @response 200 OK with rejected request
|
|
||||||
* @response 404 Not Found
|
|
||||||
* @response 409 Conflict
|
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAnyRole('APPROVER')")
|
@PreAuthorize("hasAnyRole('APPROVER')")
|
||||||
@PutMapping("/requests/{requestId}/reject")
|
@PutMapping("/requests/{requestId}/reject")
|
||||||
@ -425,12 +394,7 @@ public class TunnelController implements ErrorController {
|
|||||||
* @param tunnelId The Cloudflare tunnel ID (UUID)
|
* @param tunnelId The Cloudflare tunnel ID (UUID)
|
||||||
* @param user The authenticated user
|
* @param user The authenticated user
|
||||||
* @return The tunnel configuration
|
* @return The tunnel configuration
|
||||||
*
|
* @throws SecurityException if user lacks required role
|
||||||
* @security Requires ADMIN role
|
|
||||||
* @response 200 OK with tunnel
|
|
||||||
* @response 204 No Content
|
|
||||||
* @response 404 Not Found
|
|
||||||
* @response 500 Internal Server Error
|
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAnyRole('ADMIN')")
|
@PreAuthorize("hasAnyRole('ADMIN')")
|
||||||
@PutMapping("/tunnels/configure/{tunnelId}")
|
@PutMapping("/tunnels/configure/{tunnelId}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user