View Javadoc
1   package fr.paris.lutece.plugins.appcenter.modules.openam.service.client.rest;
2   
3   import java.io.IOException;
4   
5   import com.fasterxml.jackson.core.JsonGenerator;
6   import com.fasterxml.jackson.core.JsonProcessingException;
7   import com.fasterxml.jackson.databind.SerializerProvider;
8   import com.fasterxml.jackson.databind.ser.std.StdSerializer;
9   
10  public class UpdateAgentSerializer extends StdSerializer<OpenamAgentDTO>{
11  	
12  	public UpdateAgentSerializer() {
13          this(null);
14      }
15     
16      public UpdateAgentSerializer(Class<OpenamAgentDTO> t) {
17          super(t);
18      }
19   
20      @Override
21      public void serialize( OpenamAgentDTO value, JsonGenerator jgen, SerializerProvider provider) 
22      	    	      throws IOException, JsonProcessingException{
23      	
24      	 jgen.writeStartObject();
25           jgen.writeFieldName(OpenamAgentDTO.CONFIG_NOTENFORCED_URI_INVERT);
26           jgen.writeStartArray();
27           jgen.writeString("true");
28           jgen.writeEndArray();
29           
30           
31           jgen.writeFieldName(OpenamAgentDTO.CONFIG_PROFILE_ATTRIBUTE_MAPPING);
32           jgen.writeStartArray();
33           jgen.writeString("[mail]=mail");
34           jgen.writeString("[validatedAccount]=validatedAccount");
35           jgen.writeString("[inetUserStatus]=inetUserStatus");
36           jgen.writeString("[uid]=uid");
37           jgen.writeEndArray();
38           
39           jgen.writeFieldName(OpenamAgentDTO.CONFIG_LOGIN_URL_PRIORITIZED);
40           jgen.writeStartArray();
41           jgen.writeString("false");
42           jgen.writeEndArray();
43           
44           jgen.writeFieldName(OpenamAgentDTO.CONFIG_LOGIN_URL_PROBE_ENABLED);
45           jgen.writeStartArray();
46           jgen.writeString("false");
47           jgen.writeEndArray();
48           
49           jgen.writeFieldName(OpenamAgentDTO.CONFIG_FILTER_MODE);
50           jgen.writeStartArray();
51           jgen.writeString("SSO_ONLY");
52           jgen.writeEndArray();
53           
54           
55           jgen.writeFieldName(OpenamAgentDTO.CONFIG_PROFILE_ATTRIBUTE_FETCH_MODE);
56           jgen.writeStartArray();
57           jgen.writeString("HTTP_HEADER");
58           jgen.writeEndArray();
59           
60           jgen.writeFieldName(OpenamAgentDTO.CONFIG_FDQN_CHECK_ENABLE);
61           jgen.writeStartArray();
62           jgen.writeString("false");
63           jgen.writeEndArray();
64           
65           jgen.writeFieldName(OpenamAgentDTO.CONFIG_LOGOUT_URL_PRIORITIZED);
66           jgen.writeStartArray();
67           jgen.writeString("false");
68           jgen.writeEndArray();
69           
70           jgen.writeFieldName(OpenamAgentDTO.CONFIG_NOTENFORCED_URI);
71           jgen.writeStartArray();
72           int i=0;
73           for(String uri :value.getNotenforcedUri()) {
74          	 jgen.writeString("["+i+"]="+uri);
75          	 i++;
76           }
77           jgen.writeEndArray();
78           
79           jgen.writeFieldName(OpenamAgentDTO.CONFIG_LOGOUT_URL_PROBE_ENABLED);
80           jgen.writeStartArray();
81           jgen.writeString("false");
82           jgen.writeEndArray();
83           
84           jgen.writeFieldName(OpenamAgentDTO.CONFIG_HTTPSESSION_BINDING);
85           jgen.writeStartArray();
86           jgen.writeString("false");
87           jgen.writeEndArray();
88           
89           jgen.writeFieldName(OpenamAgentDTO.AM_COOKIE_NAME);
90           jgen.writeStartArray();
91           jgen.writeString(value.getCookiename( ));
92           jgen.writeEndArray();
93          
94           jgen.writeEndObject();
95      } 
96      	
97  
98  }