Skip to content

Commit ae7c6c2

Browse files
Support memcached and redis encrypted password. (#869)
* Support memcached and redis encrypted password. * Fix test run error --------- Co-authored-by: iroqueta <[email protected]>
1 parent c763ad2 commit ae7c6c2

File tree

5 files changed

+204
-1
lines changed

5 files changed

+204
-1
lines changed

gxcache-memcached/src/main/java/com/genexus/cache/memcached/Memcached.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
import com.genexus.Application;
1010
import com.genexus.CommonUtil;
1111
import com.genexus.ICacheService2;
12+
import com.genexus.util.Encryption;
1213
import com.genexus.util.GXService;
1314
import com.genexus.util.GXServices;
1415

16+
1517
import net.spy.memcached.AddrUtil;
1618
import net.spy.memcached.BinaryConnectionFactory;
1719
import net.spy.memcached.ConnectionFactoryBuilder;
@@ -42,6 +44,7 @@ MemcachedClient InitCache() throws IOException {
4244
}
4345
else
4446
{
47+
password = Encryption.tryDecrypt64(password);
4548
AuthDescriptor ad = new AuthDescriptor(new String[]{"PLAIN"},
4649
new PlainCallbackHandler(username, password));
4750

gxcache-redis/client.cfg

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
[Client]
2+
MODEL_NUM= 2
3+
GENERATOR_NUM= 12
4+
LOGIN_AS_USERID=0
5+
SMTP_HOST=
6+
NAME_SPACE=com.genexus.sampleapp
7+
NAME_HOST=
8+
CORBA_SERVER_NAME=
9+
DCOM_GUID=
10+
CONN_TIMEOUT=300
11+
HELP_MODE=WINHTML
12+
HELP_BASEURL=
13+
PREFERRED_UI=BEST
14+
MY_CUSTOM_PTY=SAMPLE_VALUE_FOR_ROOTCFG
15+
JFC_LF=NATIVE
16+
CALENDAR=1
17+
CALC=1
18+
WP_RESIZE=1
19+
SHOW_STATUS=1
20+
FIELD_EXIT=Tab
21+
ESCAPE_FUNCTION=Exit_form
22+
KEY_REFRESH=5
23+
KEY_PROMPT=4
24+
MDI_FORMS=1
25+
REMOTE_CALLS=NEVER
26+
IMAGE_SUBST=0
27+
CS_CONNECT=First
28+
CS_REORG=1
29+
CS_REORGJAVA=1
30+
SUBFILE_ORDER=Y
31+
FC_READONLY=GRAYED
32+
PACKAGE=com.genexus.sampleapp
33+
DECIMAL_POINT=.
34+
DATE_FMT= DMY
35+
CTOD_DATE_FMT= L
36+
BLANK_EMPTY_DATE=0
37+
TIME_FMT=12
38+
YEAR_LIMIT=40
39+
COMPRESS_HTML=1
40+
DocumentType=HTML5
41+
IE_COMPATIBILITY_VIEW=EmulateIE7
42+
EXPOSE_METADATA= 0
43+
WEB_IMAGE_DIR=/static
44+
HTTP_BACKEND_URL=
45+
WEB_STATIC_DIR=
46+
ORQ_CLIENT_URL=
47+
ORQ_SERVER_DIR=
48+
TMPMEDIA_DIR=PrivateTempStorage
49+
PRINT_LAYOUT_METADATA_DIR=LayoutMetadata
50+
HTTP_PROTOCOL=Unsecure
51+
SAMESITE_COOKIE=Lax
52+
StorageTimeZone= 1
53+
GX_BUILD_NUMBER=17233991
54+
ODBC_CALLS=0
55+
NameSpace1=com.genexus.sampleapp
56+
LANGUAGE=German
57+
LANG_NAME=German
58+
Theme=Carmine
59+
CS_BLOB_PATH=PublicTempStorage
60+
SUBMIT_POOL_SIZE=5
61+
CACHE_TTL_0=-1
62+
CACHE_TTL_1=60
63+
CACHE_TTL_2=600
64+
CACHE_TTL_3=0
65+
CACHE_STORAGE_SIZE=0
66+
CACHING=0
67+
SMART_CACHING=0
68+
CACHE_INVALIDATION_TOKEN=202231018204023
69+
EVENT_BEFORE_COMMIT=
70+
EVENT_AFTER_COMMIT=
71+
EVENT_BEFORE_ROLLBACK=
72+
EVENT_AFTER_ROLLBACK=
73+
EVENT_BEFORE_CONNECT=
74+
EVENT_AFTER_CONNECT=
75+
ENABLE_MANAGEMENT=0
76+
EnableIntegratedSecurity=0
77+
IntegratedSecurityLoginWeb=
78+
IntegratedSecurityNotAuthorizedWeb=
79+
HTTPCLIENT_MAX_SIZE=1000
80+
HTTPCLIENT_MAX_PER_ROUTE=1000
81+
VER_STAMP=20220103.214234
82+
[language|English]
83+
code= eng
84+
time_fmt= 12
85+
decimal_point= .
86+
thousand_sep= ,
87+
date_fmt= MDY
88+
culture= en-US
89+
[language|German]
90+
code= German
91+
time_fmt= 12
92+
decimal_point= .
93+
thousand_sep= ,
94+
date_fmt= DMY
95+
culture= de-DE
96+
[language|TraditionalChinese]
97+
code= cht
98+
time_fmt= 24
99+
decimal_point= .
100+
thousand_sep= ,
101+
date_fmt= YMD
102+
culture= zh-TW
103+
[language|SimplifiedChinese]
104+
code= chs
105+
time_fmt= 24
106+
decimal_point= .
107+
thousand_sep= ,
108+
date_fmt= YMD
109+
culture= zh-CN
110+
[language|Spanish]
111+
code= spa
112+
time_fmt= 24
113+
decimal_point= ,
114+
thousand_sep= .
115+
date_fmt= DMY
116+
culture= es-ES
117+
[language|Japanese]
118+
code= jap
119+
time_fmt= 24
120+
decimal_point= .
121+
thousand_sep= ,
122+
date_fmt= YMD
123+
culture= ja-JP
124+
[language|Portuguese]
125+
code= por
126+
time_fmt= 24
127+
decimal_point= ,
128+
thousand_sep= .
129+
date_fmt= DMY
130+
culture= pt-BR
131+
[language|Italian]
132+
code= ita
133+
time_fmt= 24
134+
decimal_point= ,
135+
thousand_sep= .
136+
date_fmt= DMY
137+
culture= it-IT
138+
[language|Arabic]
139+
code= Arabic
140+
time_fmt= 24
141+
decimal_point= ,
142+
thousand_sep= .
143+
date_fmt= DMY
144+
culture= ar-SA
145+
[com.genexus.sampleapp]
146+
GXDB_LOCATION=
147+
JTA=0
148+
DataSource1=DEFAULT
149+
JDBC_LOG= c:\temp\UTL.log
150+
JDBCLogEnabled=1
151+
JDBCUniqueName=0
152+
JDBCLogPath=
153+
JDBCLogLevel=0
154+
JDBCLogBuffer=0
155+
JDBCLogDetail=0
156+
[com.genexus.sampleapp|DEFAULT]
157+
CS_DBNAME=
158+
INFORMIX_DB=ANSI
159+
CS_LIBL400=
160+
CS_PACKAGE400=
161+
DB2400_DATE_DATATYPE=
162+
CS_SCHEMA=
163+
USER_ID=G8xdg8k/gK9eOCDgU75tkr==
164+
USER_PASSWORD=4gPZ5cDtMVud7diJ/gIVrg==
165+
CS_CONNECT=First
166+
WAIT_RECORD=0
167+
LOCK_RETRY=10
168+
LoginInServer=1
169+
JDBC_DRIVER=org.sqlite.JDBC
170+
DB_URL=jdbc:sqlite:sample.db
171+
USE_JDBC_DATASOURCE=0
172+
JDBC_DATASOURCE=
173+
MAX_CURSOR=100
174+
INITIALIZE_NEW=1
175+
ISOLATION_LEVEL=CR
176+
XBASE_TINT=1
177+
DBMS=sqlite
178+
UnlimitedRWPool=1
179+
PoolRWEnabled=1
180+
RecycleRW=1
181+
RecycleRWType=1
182+
RecycleRWMin=30
183+
POOLSIZE_RW=10
184+
POOL_STARTUP=0

gxcache-redis/src/main/java/com/genexus/cache/redis/RedisClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.genexus.ICacheService2;
1919
import com.genexus.diagnostics.core.ILogger;
2020
import com.genexus.diagnostics.core.LogManager;
21+
import com.genexus.util.Encryption;
2122
import com.genexus.util.GXService;
2223
import com.genexus.util.GXServices;
2324

@@ -74,7 +75,7 @@ private void initCache(String hostOrRedisURL, String password, String cacheKeyPa
7475
throw e;
7576
}
7677

77-
password = (!isNullOrEmpty(password)) ? password : null;
78+
password = (!isNullOrEmpty(password)) ? Encryption.tryDecrypt64(password) : null;
7879

7980
pool = new JedisPool(new JedisPoolConfig(), host, port, redis.clients.jedis.Protocol.DEFAULT_TIMEOUT, password);
8081

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.genexus.sampleapp;
2+
import com.genexus.*;
3+
4+
public final class GXcfg
5+
{
6+
public static int strcmp( String Left ,
7+
String Right )
8+
{
9+
return GXutil.rtrim(Left).compareTo(GXutil.rtrim(Right));
10+
}
11+
12+
}
13+

gxcache-redis/src/test/java/com/genexus/test/cache/redis/TestRedisCacheClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.genexus.test.cache.redis;
22

3+
import com.genexus.Application;
34
import com.genexus.cache.redis.RedisClient;
45
import com.genexus.db.CacheValue;
56
import org.apache.logging.log4j.LogManager;
@@ -24,6 +25,7 @@ public void beforeTest() {
2425

2526
Connect.init();
2627
com.genexus.specific.java.LogManager.initialize(".");
28+
Application.init(com.genexus.sampleapp.GXcfg.class);
2729
}
2830

2931
@Test

0 commit comments

Comments
 (0)