1. Project Clover database Mon Dec 22 2025 14:59:38 CST
  2. Package org.europa.together.business

File JsonWebToken.java

 

Code metrics

0
0
0
1
105
26
0
-
-
0
-

Classes

Class Line # Actions
JsonWebToken 14 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package org.europa.together.business;
2   
3    import java.util.List;
4    import org.apiguardian.api.API;
5    import static org.apiguardian.api.API.Status.STABLE;
6    import org.europa.together.exceptions.JsonProcessingException;
7    import org.springframework.stereotype.Component;
8   
9    /**
10    * Create cyryptograpic signatures for JSON.
11    */
12    @API(status = STABLE, since = "3.1", consumers = "NimbusJwt")
13    @Component
 
14    public interface JsonWebToken {
15   
16    /**
17    * Identifier for the given feature.
18    */
19    @API(status = STABLE, since = "3.1")
20    String FEATURE_ID = "CM-16";
21   
22    /**
23    * Define the configuration set for the MailClient.
24    */
25    @API(status = STABLE, since = "3.2")
26    String CONFIG_SET = "json";
27   
28    /**
29    * Defines for which MODULE_VERSION the configuration will work.
30    */
31    @API(status = STABLE, since = "3.2")
32    String CONFIG_VERSION = "1.0";
33   
34    /**
35    * JSON Web Signature (JWS) represents content secured with digital
36    * signatures or Message Authentication Codes (MACs) using JSON-based data
37    * structures. Cryptographic algorithms and identifiers for use with this
38    * specification are described in the separate JSON Web Algorithms (JWA)
39    * specification and an IANA registry defined by that specification. Related
40    * encryption capabilities are described in the separate JSON Web Encryption
41    * (JWE) specification.
42    *
43    * @param payload as String
44    * @return JWS as String
45    * @throws JsonProcessingException case of error
46    */
47    String buildHMAC512SignedJws(String payload)
48    throws JsonProcessingException;
49   
50    /**
51    * Create a JSON Web Token. JSON Web Token (JWT) is a compact, URL-safe
52    * means of representing claims to be transferred between two parties. The
53    * claims in a JWT are encoded as a JSON object that is used as the payload
54    * of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web
55    * Encryption (JWE) structure, enabling the claims to be digitally signed or
56    * integrity protected with a Message Authentication Code (MAC) and/or
57    * encrypted.
58    *
59    * @param issuer as String
60    * @param subject as String
61    * @param audience as List of Strings
62    * @return JWT as String
63    * @throws JsonProcessingException case of error
64    */
65    String buildHMAC512SignedJwt(String issuer, String subject, List<String> audience)
66    throws JsonProcessingException;
67   
68    /**
69    * Create a JSON Web Token. JSON Web Token (JWT) is a compact, URL-safe
70    * means of representing claims to be transferred between two parties. The
71    * claims in a JWT are encoded as a JSON object that is used as the payload
72    * of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web
73    * Encryption (JWE) structure, enabling the claims to be digitally signed or
74    * integrity protected with a Message Authentication Code (MAC) and/or
75    * encrypted. issuer and subject get fetched from DB entries.
76    *
77    * @param audience as List of Strings
78    * @return JWT as String
79    * @throws JsonProcessingException case of error
80    */
81    String buildHMAC512SignedJwt(List<String> audience)
82    throws JsonProcessingException;
83   
84    /**
85    * Parse a JWS String and validate the signature. If the siganture is
86    * invalid it throws an JsonProcessingException.
87    *
88    * @param jws as String
89    * @return encoded JWS as String
90    * @throws JsonProcessingException case of error
91    */
92    String parseHMAC512SingedJws(String jws)
93    throws JsonProcessingException;
94   
95    /**
96    * Parse a JWT String and validate the signature. If the siganture is
97    * invalid it throws an JsonProcessingException.
98    *
99    * @param jwt as String
100    * @return encoded JWT as String
101    * @throws JsonProcessingException case of error
102    */
103    String parseHMAC512SingedJwt(String jwt)
104    throws JsonProcessingException;
105    }