@Test @WithMockUser(authorities = { "VIEW_KEYS" }) public void getToken() { try { tokensApiController.getToken(TOKEN_NOT_FOUND_TOKEN_ID); fail("should have thrown exception"); } catch (ResourceNotFoundException expected) { } ResponseEntity<Token> response = tokensApiController.getToken(GOOD_TOKEN_ID); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(GOOD_TOKEN_ID, response.getBody().getId()); }
@Override @PreAuthorize("hasAuthority('VIEW_KEYS')") public ResponseEntity<Token> getToken(String id) { Token token = getTokenFromService(id); return new ResponseEntity<>(token, HttpStatus.OK); }
TokensApiController implements TokensApi { @Override @PreAuthorize("hasAuthority('VIEW_KEYS')") public ResponseEntity<Token> getToken(String id) { Token token = getTokenFromService(id); return new ResponseEntity<>(token, HttpStatus.OK); } }
TokensApiController implements TokensApi { @Override @PreAuthorize("hasAuthority('VIEW_KEYS')") public ResponseEntity<Token> getToken(String id) { Token token = getTokenFromService(id); return new ResponseEntity<>(token, HttpStatus.OK); } @Autowired  TokensApiController(KeyConverter keyConverter, KeyService keyService,
            TokenService tokenService,
            TokenConverter tokenConverter,
            ClientConverter clientConverter,
            KeyAndCertificateRequestService keyAndCertificateRequestService); }
TokensApiController implements TokensApi { @Override @PreAuthorize("hasAuthority('VIEW_KEYS')") public ResponseEntity<Token> getToken(String id) { Token token = getTokenFromService(id); return new ResponseEntity<>(token, HttpStatus.OK); } @Autowired  TokensApiController(KeyConverter keyConverter, KeyService keyService,
            TokenService tokenService,
            TokenConverter tokenConverter,
            ClientConverter clientConverter,
            KeyAndCertificateRequestService keyAndCertificateRequestService); @PreAuthorize("hasAuthority('VIEW_KEYS')") @Override ResponseEntity<List<Token>> getTokens(); @Override @PreAuthorize("hasAuthority('VIEW_KEYS')") ResponseEntity<Token> getToken(String id); @PreAuthorize("hasAuthority('ACTIVATE_DEACTIVATE_TOKEN')") @Override @AuditEventMethod(event = LOGIN_TOKEN) ResponseEntity<Token> loginToken(String id, TokenPassword tokenPassword); @PreAuthorize("hasAuthority('ACTIVATE_DEACTIVATE_TOKEN')") @Override @AuditEventMethod(event = LOGOUT_TOKEN) ResponseEntity<Token> logoutToken(String id); @PreAuthorize("hasAuthority('EDIT_TOKEN_FRIENDLY_NAME')") @Override @AuditEventMethod(event = UPDATE_TOKEN_NAME) ResponseEntity<Token> updateToken(String id, TokenName tokenName); @PreAuthorize("hasAuthority('GENERATE_KEY')") @Override @AuditEventMethod(event = GENERATE_KEY) ResponseEntity<Key> addKey(String tokenId, KeyLabel keyLabel); @Override @PreAuthorize("hasAuthority('GENERATE_KEY') " + " and (hasAuthority('GENERATE_AUTH_CERT_REQ') or hasAuthority('GENERATE_SIGN_CERT_REQ'))") @AuditEventMethod(event = GENERATE_KEY_AND_CSR) ResponseEntity<KeyWithCertificateSigningRequestId> addKeyAndCsr(String tokenId,
            KeyLabelWithCsrGenerate keyLabelWithCsrGenerate); }
TokensApiController implements TokensApi { @Override @PreAuthorize("hasAuthority('VIEW_KEYS')") public ResponseEntity<Token> getToken(String id) { Token token = getTokenFromService(id); return new ResponseEntity<>(token, HttpStatus.OK); } @Autowired  TokensApiController(KeyConverter keyConverter, KeyService keyService,
            TokenService tokenService,
            TokenConverter tokenConverter,
            ClientConverter clientConverter,
            KeyAndCertificateRequestService keyAndCertificateRequestService); @PreAuthorize("hasAuthority('VIEW_KEYS')") @Override ResponseEntity<List<Token>> getTokens(); @Override @PreAuthorize("hasAuthority('VIEW_KEYS')") ResponseEntity<Token> getToken(String id); @PreAuthorize("hasAuthority('ACTIVATE_DEACTIVATE_TOKEN')") @Override @AuditEventMethod(event = LOGIN_TOKEN) ResponseEntity<Token> loginToken(String id, TokenPassword tokenPassword); @PreAuthorize("hasAuthority('ACTIVATE_DEACTIVATE_TOKEN')") @Override @AuditEventMethod(event = LOGOUT_TOKEN) ResponseEntity<Token> logoutToken(String id); @PreAuthorize("hasAuthority('EDIT_TOKEN_FRIENDLY_NAME')") @Override @AuditEventMethod(event = UPDATE_TOKEN_NAME) ResponseEntity<Token> updateToken(String id, TokenName tokenName); @PreAuthorize("hasAuthority('GENERATE_KEY')") @Override @AuditEventMethod(event = GENERATE_KEY) ResponseEntity<Key> addKey(String tokenId, KeyLabel keyLabel); @Override @PreAuthorize("hasAuthority('GENERATE_KEY') " + " and (hasAuthority('GENERATE_AUTH_CERT_REQ') or hasAuthority('GENERATE_SIGN_CERT_REQ'))") @AuditEventMethod(event = GENERATE_KEY_AND_CSR) ResponseEntity<KeyWithCertificateSigningRequestId> addKeyAndCsr(String tokenId,
            KeyLabelWithCsrGenerate keyLabelWithCsrGenerate);  }