View Javadoc
1   /*
2    * Copyright (c) 2002-2015, Mairie de Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.franceconnect.oidc;
35  
36  
37  /**
38   * IDToken : informations provided by a JWT (Json Web Token)
39   */
40  public class IDToken
41  {
42      private String _strAudience;
43      private String _strExpiration;
44      private String _strIssueAt;
45      private String _strIssuer;
46      private String _strSubject;
47      private String _strIdProvider;
48      private String _strNonce;
49      private String _strAcr;
50  
51      /**
52       * Returns the Audience
53       * @return The Audience
54       */
55      public String getAudience(  )
56      {
57          return _strAudience;
58      }
59  
60      /**
61       * Sets the Audience
62       * @param strAudience The Audience
63       */
64      public void setAudience( String strAudience )
65      {
66          _strAudience = strAudience;
67      }
68  
69      /**
70       * Returns the Expiration
71       * @return The Expiration
72       */
73      public String getExpiration(  )
74      {
75          return _strExpiration;
76      }
77  
78      /**
79       * Sets the Expiration
80       * @param strExpiration The Expiration
81       */
82      public void setExpiration( String strExpiration )
83      {
84          _strExpiration = strExpiration;
85      }
86  
87      /**
88       * Returns the IssueAt
89       * @return The IssueAt
90       */
91      public String getIssueAt(  )
92      {
93          return _strIssueAt;
94      }
95  
96      /**
97       * Sets the IssueAt
98       * @param strIssueAt The IssueAt
99       */
100     public void setIssueAt( String strIssueAt )
101     {
102         _strIssueAt = strIssueAt;
103     }
104 
105     /**
106      * Returns the Issuer
107      * @return The Issuer
108      */
109     public String getIssuer(  )
110     {
111         return _strIssuer;
112     }
113 
114     /**
115      * Sets the Issuer
116      * @param strIssuer The Issuer
117      */
118     public void setIssuer( String strIssuer )
119     {
120         _strIssuer = strIssuer;
121     }
122 
123     /**
124      * Returns the Subject
125      * @return The Subject
126      */
127     public String getSubject(  )
128     {
129         return _strSubject;
130     }
131 
132     /**
133      * Sets the Subject
134      * @param strSubject The Subject
135      */
136     public void setSubject( String strSubject )
137     {
138         _strSubject = strSubject;
139     }
140 
141     /**
142      * Returns the IdProvider
143      * @return The IdProvider
144      */
145     public String getIdProvider(  )
146     {
147         return _strIdProvider;
148     }
149 
150     /**
151      * Sets the IdProvider
152      * @param strIdProvider The IdProvider
153      */
154     public void setIdProvider( String strIdProvider )
155     {
156         _strIdProvider = strIdProvider;
157     }
158 
159     /**
160      * Returns the Nonce
161      * @return The Nonce
162      */
163     public String getNonce(  )
164     {
165         return _strNonce;
166     }
167 
168     /**
169      * Sets the Nonce
170      * @param strNonce The Nonce
171      */
172     public void setNonce( String strNonce )
173     {
174         _strNonce = strNonce;
175     }
176 
177     /**
178      * Returns the Acr
179      * @return The Acr
180      */
181     public String getAcr(  )
182     {
183         return _strAcr;
184     }
185 
186     /**
187      * Sets the Acr
188      * @param strAcr The Acr
189      */
190     public void setAcr( String strAcr )
191     {
192         _strAcr = strAcr;
193     }
194 
195     /**
196      * {@inheritDoc }
197      */
198     @Override
199     public String toString(  )
200     {
201         StringBuilder sbToken = new StringBuilder(  );
202         sbToken.append( "Token ID infos : \n  aud : " ).append( _strAudience ).append( "\n  exp : " )
203                .append( _strExpiration ).append( "\n  iat : " ).append( _strIssueAt ).append( "\n  iss : " )
204                .append( _strIssuer ).append( "\n  sub : " ).append( _strSubject ).append( "\n  idp : " )
205                .append( _strIdProvider ).append( "\n  nonce : " ).append( _strNonce ).append( "\n  acr : " )
206                .append( _strAcr ).append( "\n\n" );
207 
208         return sbToken.toString(  );
209     }
210 }