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  import org.codehaus.jackson.annotate.JsonProperty;
37  
38  import java.io.Serializable;
39  
40  import java.util.Map;
41  
42  
43  /**
44   * UserInfo
45   */
46  public class UserInfo implements Serializable
47  {
48      private static final long serialVersionUID = 1L;
49      @JsonProperty( "sub" )
50      private String _strSub;
51      @JsonProperty( "gender" )
52      private String _strGender;
53      @JsonProperty( "name" )
54      private String _strName;
55      @JsonProperty( "preferred_username" )
56      private String _strPreferredUsername;
57      @JsonProperty( "given_name" )
58      private String _strGivenName;
59      @JsonProperty( "family_name" )
60      private String _strFamilyName;
61      @JsonProperty( "middle_name" )
62      private String _strMiddleName;
63      @JsonProperty( "nickname" )
64      private String _strNickname;
65      @JsonProperty( "profile" )
66      private String _strProfile;
67      @JsonProperty( "picture" )
68      private String _strPicture;
69      @JsonProperty( "website" )
70      private String _strWebsite;
71      @JsonProperty( "zone_info" )
72      private String _strZoneInfo;
73      @JsonProperty( "locale" )
74      private String _strLocale;
75      @JsonProperty( "updated_time" )
76      private String _strUpdatedTime;
77      @JsonProperty( "birthdate" )
78      private String _strBirthDate;
79      @JsonProperty( "birthcountry" )
80      private String _strBirthCountry;
81      @JsonProperty( "birthplace" )
82      private String _strBirthPlace;
83      @JsonProperty( "email" )
84      private String _strEmail;
85      @JsonProperty( "email_verified" )
86      private String _strEmailVerified;
87      @JsonProperty( "phone_number" )
88      private String _strPhoneNumber;
89      @JsonProperty( "phone_number_verified" )
90      private String _strPhoneNumberVerified;
91  
92      //The addess object
93      //"address" : {
94      //   "country" : "France",
95      //   "street_address" : "26 rue Desaix",
96      //   "postal_code" : "75015",
97      //   "formatted" : "26 rue Desaix, 75015 Paris",
98      //   "region" : "Ile-de-France",
99      //   "locality" : "Paris"
100     //},
101     private String _strAddressCountry;
102     private String _strAddressStreetAddress;
103     private String _strAddressPostalCode;
104     private String _strAddressFormatted;
105     private String _strAddressRegion;
106     private String _strAddressLocality;
107 
108     /**
109      * Returns the Sub
110      * @return The Sub
111      */
112     public String getSub(  )
113     {
114         return _strSub;
115     }
116 
117     /**
118      * Sets the Sub
119      * @param strSub The Sub
120      */
121     public void setSub( String strSub )
122     {
123         _strSub = strSub;
124     }
125 
126     /**
127      * Returns the Gender
128      * @return The Gender
129      */
130     public String getGender(  )
131     {
132         return _strGender;
133     }
134 
135     /**
136      * Sets the Gender
137      * @param strGender The Gender
138      */
139     public void setGender( String strGender )
140     {
141         _strGender = strGender;
142     }
143 
144     /**
145      * Returns the Name
146      * @return The Name
147      */
148     public String getName(  )
149     {
150         return _strName;
151     }
152 
153     /**
154      * Sets the Name
155      * @param strName The Name
156      */
157     public void setName( String strName )
158     {
159         _strName = strName;
160     }
161 
162     /**
163      * Returns the PreferredUsername
164      * @return The PreferredUsername
165      */
166     public String getPreferredUsername(  )
167     {
168         return _strPreferredUsername;
169     }
170 
171     /**
172      * Sets the PreferredUsername
173      * @param strPreferredUsername The PreferredUsername
174      */
175     public void setPreferredUsername( String strPreferredUsername )
176     {
177         _strPreferredUsername = strPreferredUsername;
178     }
179 
180     /**
181      * Returns the GivenName
182      * @return The GivenName
183      */
184     public String getGivenName(  )
185     {
186         return _strGivenName;
187     }
188 
189     /**
190      * Sets the GivenName
191      * @param strGivenName         The GivenName
192      */
193     public void setGivenName( String strGivenName )
194     {
195         _strGivenName = strGivenName;
196     }
197 
198     /**
199      * Returns the FamilyName
200      * @return The FamilyName
201      */
202     public String getFamilyName(  )
203     {
204         return _strFamilyName;
205     }
206 
207     /**
208      * Sets the FamilyName
209      * @param strFamilyName The FamilyName
210      */
211     public void setFamilyName( String strFamilyName )
212     {
213         _strFamilyName = strFamilyName;
214     }
215 
216     /**
217      * Returns the MiddleName
218      * @return The MiddleName
219      */
220     public String getMiddleName(  )
221     {
222         return _strMiddleName;
223     }
224 
225     /**
226      * Sets the MiddleName
227      * @param strMiddleName The MiddleName
228      */
229     public void setMiddleName( String strMiddleName )
230     {
231         _strMiddleName = strMiddleName;
232     }
233 
234     /**
235      * Returns the Nickname
236      * @return The Nickname
237      */
238     public String getNickname(  )
239     {
240         return _strNickname;
241     }
242 
243     /**
244      * Sets the Nickname
245      * @param strNickname         The Nickname
246      */
247     public void setNickname( String strNickname )
248     {
249         _strNickname = strNickname;
250     }
251 
252     /**
253      * Returns the Profile
254      * @return The Profile
255      */
256     public String getProfile(  )
257     {
258         return _strProfile;
259     }
260 
261     /**
262      * Sets the Profile
263      * @param strProfile         The Profile
264      */
265     public void setProfile( String strProfile )
266     {
267         _strProfile = strProfile;
268     }
269 
270     /**
271      * Returns the Picture
272      * @return The Picture
273      */
274     public String getPicture(  )
275     {
276         return _strPicture;
277     }
278 
279     /**
280      * Sets the Picture
281      * @param strPicture         The Picture
282      */
283     public void setPicture( String strPicture )
284     {
285         _strPicture = strPicture;
286     }
287 
288     /**
289      * Returns the Website
290      * @return The Website
291      */
292     public String getWebsite(  )
293     {
294         return _strWebsite;
295     }
296 
297     /**
298      * Sets the Website
299      * @param strWebsite         The Website
300      */
301     public void setWebsite( String strWebsite )
302     {
303         _strWebsite = strWebsite;
304     }
305 
306     /**
307      * Returns the ZoneInfo
308      * @return The ZoneInfo
309      */
310     public String getZoneInfo(  )
311     {
312         return _strZoneInfo;
313     }
314 
315     /**
316      * Sets the ZoneInfo
317      * @param strZoneInfo The ZoneInfo
318      */
319     public void setZoneInfo( String strZoneInfo )
320     {
321         _strZoneInfo = strZoneInfo;
322     }
323 
324     /**
325      * Returns the Locale
326      * @return The Locale
327      */
328     public String getLocale(  )
329     {
330         return _strLocale;
331     }
332 
333     /**
334      * Sets the Locale
335      * @param strLocale         The Locale
336      */
337     public void setLocale( String strLocale )
338     {
339         _strLocale = strLocale;
340     }
341 
342     /**
343      * Returns the UpdatedTime
344      * @return The UpdatedTime
345      */
346     public String getUpdatedTime(  )
347     {
348         return _strUpdatedTime;
349     }
350 
351     /**
352      * Sets the UpdatedTime
353      * @param strUpdatedTime         The UpdatedTime
354      */
355     public void setUpdatedTime( String strUpdatedTime )
356     {
357         _strUpdatedTime = strUpdatedTime;
358     }
359 
360     /**
361      * Returns the BirthDate
362      * @return The BirthDate
363      */
364     public String getBirthDate(  )
365     {
366         return _strBirthDate;
367     }
368 
369     /**
370      * Sets the BirthDate
371      * @param strBirthDate The BirthDate
372      */
373     public void setBirthDate( String strBirthDate )
374     {
375         _strBirthDate = strBirthDate;
376     }
377 
378     /**
379      * Returns the BirthCountry
380      * @return The BirthCountry
381      */
382     public String getBirthCountry(  )
383     {
384         return _strBirthCountry;
385     }
386 
387     /**
388      * Sets the BirthCountry
389      * @param strBirthCountry The BirthCountry
390      */
391     public void setBirthCountry( String strBirthCountry )
392     {
393         _strBirthCountry = strBirthCountry;
394     }
395 
396     /**
397      * Returns the BirthPlace
398      * @return The BirthPlace
399      */
400     public String getBirthPlace(  )
401     {
402         return _strBirthPlace;
403     }
404 
405     /**
406      * Sets the BirthPlace
407      * @param strBirthPlace The BirthPlace
408      */
409     public void setBirthPlace( String strBirthPlace )
410     {
411         _strBirthPlace = strBirthPlace;
412     }
413 
414     /**
415      * Returns the Email
416      * @return The Email
417      */
418     public String getEmail(  )
419     {
420         return _strEmail;
421     }
422 
423     /**
424      * Sets the Email
425      * @param strEmail         The Email
426      */
427     public void setEmail( String strEmail )
428     {
429         _strEmail = strEmail;
430     }
431 
432     /**
433      * Returns the EmailVerified
434      * @return The EmailVerified
435      */
436     public String getEmailVerified(  )
437     {
438         return _strEmailVerified;
439     }
440 
441     /**
442      * Sets the EmailVerified
443      * @param strEmailVerified         The EmailVerified
444      */
445     public void setEmailVerified( String strEmailVerified )
446     {
447         _strEmailVerified = strEmailVerified;
448     }
449 
450     /**
451      * Returns the PhoneNumber
452      * @return The PhoneNumber
453      */
454     public String getPhoneNumber(  )
455     {
456         return _strPhoneNumber;
457     }
458 
459     /**
460      * Sets the PhoneNumber
461      * @param strPhoneNumber         The PhoneNumber
462      */
463     public void setPhoneNumber( String strPhoneNumber )
464     {
465         _strPhoneNumber = strPhoneNumber;
466     }
467 
468     /**
469      * Returns the PhoneNumberVerified
470      * @return The PhoneNumberVerified
471      */
472     public String getPhoneNumberVerified(  )
473     {
474         return _strPhoneNumberVerified;
475     }
476 
477     /**
478      * Sets the PhoneNumberVerified
479      * @param strPhoneNumberVerified The PhoneNumberVerified
480      */
481     public void setPhoneNumberVerified( String strPhoneNumberVerified )
482     {
483         _strPhoneNumberVerified = strPhoneNumberVerified;
484     }
485 
486     /**
487      * Returns the Address
488      * Kept for backwards compatibily, same as getAddressFormatted()
489      * @return The Address
490      */
491     public String getAddress(  )
492     {
493         return _strAddressFormatted;
494     }
495 
496     /**
497      * Returns the AddressCountry
498      * @return The Address country
499      */
500     public String getAddressCountry(  )
501     {
502         return _strAddressCountry;
503     }
504 
505     /**
506      * Returns the AddressStreetAddress
507      * @return The Address street address
508      */
509     public String getAddressStreetAddress(  )
510     {
511         return _strAddressStreetAddress;
512     }
513 
514     /**
515      * Returns the AddressPostalCode
516      * @return The Address postal code
517      */
518     public String getAddressPostalCode(  )
519     {
520         return _strAddressPostalCode;
521     }
522 
523     /**
524      * Returns the AddressFormatted
525      * @return The Address formatted
526      */
527     public String getAddressFormatted(  )
528     {
529         return _strAddressFormatted;
530     }
531 
532     /**
533      * Returns the AddressRegion
534      * @return The Address region
535      */
536     public String getAddressRegion(  )
537     {
538         return _strAddressRegion;
539     }
540 
541     /**
542      * Returns the AddressLocality
543      * @return The Address locality
544      */
545     public String getAddressLocality(  )
546     {
547         return _strAddressLocality;
548     }
549 
550     /**
551      * Sets the Address fields from a json object
552      * @param addressObject The Map of fields of address
553      */
554     @JsonProperty( "address" )
555     public void setAddressObject( Map<String, Object> addressObject )
556     {
557         _strAddressCountry = (String) addressObject.get( "country" );
558         _strAddressStreetAddress = (String) addressObject.get( "street_address" );
559         _strAddressPostalCode = (String) addressObject.get( "postal_code" );
560         _strAddressFormatted = (String) addressObject.get( "formatted" );
561         _strAddressRegion = (String) addressObject.get( "region" );
562         _strAddressLocality = (String) addressObject.get( "locality" );
563     }
564 }