1. Project Clover database Wed Jan 17 2024 23:40:18 CST
  2. Package org.europa.together.business

File JsonWebToken.java

 

Code metrics

0
0
0
1
65
22
0
-
-
0
-

Classes

Class Line # Actions
JsonWebToken 15 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    *
11    * @author ed
12    */
13    @API(status = STABLE, since = "3.1", consumers = "NimbusJwt")
14    @Component
 
15    public interface JsonWebToken {
16   
17    /**
18    * Identifier for the given feature.
19    */
20    @API(status = STABLE, since = "3.1")
21    String FEATURE_ID = "CM-16";
22   
23    @API(status = STABLE, since = "3.1")
24    String VERSION = "1.0";
25   
26    /**
27    * JSON Web Signature (JWS) represents content secured with digital
28    * signatures or Message Authentication Codes (MACs) using JSON-based data
29    * structures. Cryptographic algorithms and identifiers for use with this
30    * specification are described in the separate JSON Web Algorithms (JWA)
31    * specification and an IANA registry defined by that specification. Related
32    * encryption capabilities are described in the separate JSON Web Encryption
33    * (JWE) specification.
34    *
35    * @param payload as String
36    * @return JWS as String
37    * @throws JsonProcessingException
38    */
39    String buildHMAC512SignedJws(String payload)
40    throws JsonProcessingException;
41   
42    /**
43    * Create a JSON Web Token. JSON Web Token (JWT) is a compact, URL-safe
44    * means of representing claims to be transferred between two parties. The
45    * claims in a JWT are encoded as a JSON object that is used as the payload
46    * of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web
47    * Encryption (JWE) structure, enabling the claims to be digitally signed or
48    * integrity protected with a Message Authentication Code (MAC) and/or
49    * encrypted.
50    *
51    * @param issuer as String
52    * @param subject as String
53    * @param audience as List of Strings
54    * @return JWT as String
55    * @throws JsonProcessingException
56    */
57    String buildHMAC512SignedJwt(String issuer, String subject, List<String> audience)
58    throws JsonProcessingException;
59   
60    String parseHMAC512SingedJws(String jws)
61    throws JsonProcessingException;
62   
63    String parseHMAC512SingedJwt(String jwt)
64    throws JsonProcessingException;
65    }