11
11
public class GamSamlProperties {
12
12
public static final ILogger logger = LogManager .getLogger (GamSamlProperties .class );
13
13
private static GamSamlProperties instance = null ;
14
- private Properties generalPropsProperties = null ;
15
- private Properties attPropsProperties = null ;
14
+ private Properties generalProperties ;
15
+ private Properties attPropsProperties ;
16
16
private static String state = "" ;
17
17
18
18
private GamSamlProperties () {
19
+ generalProperties = null ;
20
+ attPropsProperties = null ;
19
21
}
20
22
21
23
public static GamSamlProperties getInstance () {
@@ -26,32 +28,23 @@ public static GamSamlProperties getInstance() {
26
28
}
27
29
28
30
public void init (String instate ) {
29
- logger .debug ("[init] - state = " + instate );
30
- generalPropsProperties = null ;
31
- if (instate == null || instate .isEmpty ()) {
32
- logger .debug ("[init] - state state == null or empty" );
33
- state = "" ;
34
- logger .debug ("[init] sale if " );
35
-
36
- } else {
31
+ if (!(instate == null || instate .isEmpty ())) {
37
32
state = instate ;
38
33
logger .debug ("[init] - state != null" );
39
- // if state is there inicialize from GAM
40
34
try {
41
- generalPropsProperties = loadPropsFromGAM (instate );
35
+ generalProperties = load (instate );
42
36
} catch (Exception e ) {
43
37
logger .error ("[init] " , e );
44
38
}
45
39
}
46
40
}
47
41
48
- public void updatePropsFromGAM (String state ) {
49
- logger .debug ("[init] - updatePropsFromGAM = " + state );
50
- generalPropsProperties = null ;
42
+
43
+ public void update (String state ) {
51
44
try {
52
- generalPropsProperties = loadPropsFromGAM (state );
45
+ generalProperties = load (state );
53
46
} catch (Exception e ) {
54
- logger .error ("[] updatePropsFromGAM " , e );
47
+ logger .error ("update " , e );
55
48
}
56
49
}
57
50
@@ -121,7 +114,7 @@ public static String getKeyStPathCredential() {
121
114
public static String getKeyStPwdCredential () {
122
115
String cryptPass = GamSamlProperties .getInstance ().getGeneralProperty (
123
116
"KeyStPwdCredential" );
124
- String ret = Crypt . Decrypt (cryptPass );
117
+ String ret = com . genexus . util . Encryption . decrypt64 (cryptPass , getKeyCrypt () );
125
118
logger .debug ("[getKeyStPwdCredential] " + "Gets getKeyStPwdCredential: " + ret );
126
119
127
120
return ret ;
@@ -152,7 +145,8 @@ public static String getKeyStPathTrustSt() {
152
145
public static String getKeyStPwdTrustSt () {
153
146
String cryptPass = GamSamlProperties .getInstance ().getGeneralProperty (
154
147
"KeyStorePwdTrustCred" );
155
- String ret = Crypt .Decrypt (cryptPass );
148
+ //String ret = Crypt.Decrypt(cryptPass);
149
+ String ret = com .genexus .util .Encryption .decrypt64 (cryptPass , getKeyCrypt ());
156
150
logger .debug ("[getKeyStPwdTrustSt] " + "Gets KeyStorePwdTrustCred: " + cryptPass );
157
151
return ret ;
158
152
}
@@ -177,7 +171,7 @@ public static String getKeyStorePwdTrustCred() {
177
171
String cryptPass = GamSamlProperties .getInstance ().getGeneralProperty (
178
172
"KeyStorePwdTrustCred" );
179
173
logger .debug ("[getKeyStorePwdTrustCred] " + "cryptPass: " + cryptPass );
180
- String ret = Crypt . Decrypt (cryptPass );
174
+ String ret = com . genexus . util . Encryption . decrypt64 (cryptPass , getKeyCrypt () );
181
175
logger .debug ("[getKeyStorePwdTrustCred] " + "Gets KeyStorePwdTrustCred: " + ret );
182
176
return ret ;
183
177
}
@@ -213,10 +207,8 @@ public static String getPathCancelServletSSO() {
213
207
214
208
public static String getCriteriaKey () {
215
209
String cryptPass = GamSamlProperties .getInstance ().getGeneralProperty ("CriteriaKey" );
216
-
217
- String ret = Crypt .Decrypt (cryptPass );
210
+ String ret = com .genexus .util .Encryption .decrypt64 (cryptPass , getKeyCrypt ());
218
211
logger .debug ("[getCriteriaKey] " + "Gets getCriteriaKey: " + ret );
219
-
220
212
return ret ;
221
213
}
222
214
@@ -300,7 +292,7 @@ public static String getState() {
300
292
}
301
293
302
294
private String getGeneralProperty (String prop ) {
303
- return getPropertyValue (generalPropsProperties , prop );
295
+ return getPropertyValue (generalProperties , prop );
304
296
}
305
297
306
298
private String getAttProperty (String prop ) {
@@ -315,7 +307,7 @@ public String getPropertyValue(Properties config, String prop) {
315
307
}
316
308
}
317
309
318
- public Properties loadPropsFromGAM (String state ) throws Exception {
310
+ public Properties load (String state ) throws Exception {
319
311
logger .debug ("[loadPropsFromGAM] start" );
320
312
Properties config = new Properties ();
321
313
String [] resultString = new String [1 ];
@@ -337,10 +329,10 @@ public Properties loadPropsFromGAM(String state) throws Exception {
337
329
return config ;
338
330
}
339
331
340
- public void saveConfigFile (String result ) throws Exception {
332
+ public void saveConfig (String result ) throws Exception {
341
333
Properties config = new Properties ();
342
334
config .load (new StringReader (result ));
343
- generalPropsProperties = config ;
335
+ generalProperties = config ;
344
336
logger .debug ("[saveConfigFile] config: " + config .toString ());
345
337
}
346
338
}
0 commit comments