Class ApiKeyController

java.lang.Object
edu.ntnu.idatt2106_2023_06.backend.controller.ApiKeyController

@RestController @CrossOrigin("*") @RequestMapping("/api-key") public class ApiKeyController extends Object
This class represents a REST controller for managing Kassal API keys. It provides an endpoint for retrieving the API key, which is stored in the application properties. The controller uses the JwtService to authenticate the user before returning the API key.
Author:
Brage Halvorsen Kvamme, Trym Hamer Gudvangen
  • Constructor Details

    • ApiKeyController

      public ApiKeyController()
  • Method Details

    • getApiKey

      @GetMapping("/get") public org.springframework.http.ResponseEntity<Object> getApiKey()
      This method retrieves the Kassal API key if the user is authenticated.
      Returns:
      ResponseEntity containing the API key if authenticated, otherwise a bad request response.