Statistics
| Revision:

gvsig-projects-pool / org.gvsig.vcsgis / trunk / org.gvsig.vcsgis / org.gvsig.vcsgis.lib / org.gvsig.vcsgis.lib.impl / src / test / java / org / gvsig / vcsgis / lib / impl / Test19Authorization.java @ 3573

History | View | Annotate | Download (22 KB)

1
package org.gvsig.vcsgis.lib.impl;
2

    
3
import java.io.File;
4
import java.util.List;
5
import junit.framework.TestCase;
6
import static junit.framework.TestCase.assertEquals;
7
import static junit.framework.TestCase.assertNotNull;
8
import org.apache.commons.io.FileUtils;
9
import org.gvsig.expressionevaluator.Expression;
10
import org.gvsig.fmap.dal.feature.EditableFeature;
11
import org.gvsig.fmap.dal.feature.Feature;
12
import org.gvsig.fmap.dal.feature.FeatureStore;
13
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer;
14
import org.gvsig.tools.dispose.DisposeUtils;
15
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
16
import org.gvsig.vcsgis.lib.VCSGisEntity;
17
import org.gvsig.vcsgis.lib.VCSGisLocator;
18
import org.gvsig.vcsgis.lib.VCSGisManager;
19
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_NO_ERROR;
20
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_OK;
21
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_USER_NOT_AUTHORIZED;
22
import org.gvsig.vcsgis.lib.VCSGisUserIdentificationRequester;
23
import org.gvsig.vcsgis.lib.repository.VCSGisRepository;
24
import org.gvsig.vcsgis.lib.repository.VCSGisRepositoryChange;
25
import org.gvsig.vcsgis.lib.repository.localdb.VCSGisRepositoryLocaldb;
26
import org.gvsig.vcsgis.lib.repository.localdb.tables.ConfigRepoTable;
27
import org.gvsig.vcsgis.lib.repository.localdb.tables.DataRepoTable;
28
import org.gvsig.vcsgis.lib.repository.localdb.tables.EntitiesRepoTable;
29
import org.gvsig.vcsgis.lib.repository.localdb.tables.UsersRepoTable;
30
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace;
31
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceChanges;
32
import org.gvsig.vcsgis.lib.workspace.tables.WorkspaceChangesTable;
33
import org.slf4j.Logger;
34
import org.slf4j.LoggerFactory;
35

    
36
public class Test19Authorization extends TestCase {
37

    
38
    private static final Logger LOGGER = LoggerFactory.getLogger(Test19Authorization.class);
39

    
40
    public Test19Authorization(String testName) {
41
        super(testName);
42
    }
43

    
44
    @Override
45
    protected void setUp() throws Exception {
46
        super.setUp();
47
        new DefaultLibrariesInitializer().fullInitialize();
48
    }
49

    
50
    @Override
51
    protected void tearDown() throws Exception {
52
        super.tearDown();
53
    }
54

    
55
    private void check(FeatureStore store2, String relatedFeatureCode, int id, String text) throws Exception {
56
        Feature f = store2.findFirst("VCSGISCODE = '"+relatedFeatureCode+"'");
57
        assertEquals(id, f.getInt("id"));
58
        assertEquals(text, f.getString("text"));
59
    }
60

    
61
    // TODO add test methods here. The name must begin with 'test'. For example:
62
    // public void testHello() {}
63

    
64
    public void testAuthorizationAllAllowed() throws Exception {
65
        final String testid = "AuthorizationAllAllowed";
66

    
67
        VCSGisManager manager = VCSGisLocator.getVCSGisManager();
68
        JDBCServerExplorer server = TestUtils.openServerExplorer("srv-"+testid);
69
        File wsfile = TestUtils.getFile(FileUtils.getFile("test-dbs","ws-"+testid)); 
70
        File ws2file = TestUtils.getFile(FileUtils.getFile("test-dbs","ws2-"+testid)); 
71

    
72
        Feature f;
73
        EditableFeature ef;
74
        List<Feature> features;
75
        FeatureStore sourceTest;
76
        FeatureStore store2;
77

    
78
        // ---------------------------------------------------------
79
        // Creamos el respositorio y lo abrimos.
80
        int r = manager.initRepository(server.getParameters(), null);
81
        assertEquals("srv-init status", 0, r);
82

    
83
        VCSGisRepository repo = manager.openRepository(server.getParameters());
84
        TestUtils.h2sql_repository(repo);
85
        
86
        enableAuthentication(repo);
87
        addUser(repo, "user1", "password","add,entities,commit,update,checkout,history,topologyplans,users");
88

    
89
        // ---------------------------------------------------------
90
        // Creamos un workspace y lo abrimos.
91
        r = manager.initWorkspace(wsfile, repo, "Test add and commit",null);
92
        assertEquals("ws-init status", 0, r);
93
        
94
        VCSGisWorkspace ws1 = manager.openWorkspace(wsfile);
95
        TestUtils.h2sql_workspace(ws1);
96
        
97
        ws1.setUserIdentificationRequester(getIdentificationRequester("user1", "password"));
98
        
99
        // ---------------------------------------------------------
100
        // Adicionamos al workspace la tabla de pruebas y lo commitamos
101
        sourceTest = TestUtils.openSourceStore2();
102
        r = ws1.add("test", sourceTest, "text");
103
        assertEquals("ws-add status", 0, r);
104
        
105
        r = ws1.commit();
106
        assertEquals("ws-commit status", ERR_OK, r);
107
        
108
        enableAuthorizationByEntity(repo, "test");
109

    
110
        // ---------------------------------------------------------
111
        // Comprobamos que tras el commit la tabla de cambios esta vacia.
112
        FeatureStore changesStore = ws1.getFeatureStore(WorkspaceChangesTable.TABLE_NAME);
113
        assertEquals("Changes", 0, changesStore.size64());
114
        
115
        DisposeUtils.disposeQuietly(changesStore);
116
        
117
        // ---------------------------------------------------------
118
        // Comprobamos que la tabla adicionada al espacio ed trabajo contiene
119
        // los mismos registros que la original.
120
        FeatureStore dataStore = ((VCSGisRepositoryLocaldb)repo).getFeatureStore(DataRepoTable.TABLE_NAME);
121
        assertEquals("DataStore", sourceTest.size64(), dataStore.size64());
122
        
123
        sourceTest.dispose();
124
        DisposeUtils.disposeQuietly(dataStore);
125
        
126
        
127
        // ------------------------------------------------------------
128
        // Inicializamos el workspace2 asociandolo al mismo repositorio que 
129
        // workspace1 y lo abrimos.
130
        r = manager.initWorkspace(ws2file, repo, "Test update2",null);
131
        assertEquals("init_ws2 status", ERR_NO_ERROR, r);
132
        VCSGisWorkspace ws2 = manager.openWorkspace(ws2file);
133
        TestUtils.h2sql_workspace(ws2);
134
        
135
        ws2.setUserIdentificationRequester(getIdentificationRequester("user1", "password"));
136
        
137
        // ------------------------------------------------------------
138
        // Hacemos un checkout en workspace2 de la tabla "test" 
139
        // y comprobamos que tiene lo que toca.
140
        r = ws2.checkout("test");
141
        assertEquals("ws2-checkout status", ERR_NO_ERROR, r);
142
       
143
        VCSGisEntity entity = ws2.getWorkspaceEntityByName("test");
144
        assertNotNull("ws2.update-1 entity", entity);
145
        assertEquals("ws2.update-1 label", "text", entity.getFieldForLabel());
146

    
147
        store2 = ws2.getFeatureStore("test");
148
        assertEquals("ws2-checkout sizes", 3, store2.size64());
149
        features = store2.getFeatures((Expression)null, "id", true);
150
        assertEquals(1    , features.get(0).getInt("id"));
151
        assertEquals("AAA", features.get(0).getString("text"));
152
        assertEquals(2    , features.get(1).getInt("id"));
153
        assertEquals("BBB", features.get(1).getString("text"));
154
        assertEquals(3    , features.get(2).getInt("id"));
155
        assertEquals("CCC", features.get(2).getString("text"));
156
        
157
        DisposeUtils.disposeQuietly(store2);
158
        
159
        
160
        // ------------------------------------------------------------
161
        // Modificamos la tabla "test" en el workspace1 y la commitamos.
162
        sourceTest = ws1.getFeatureStore("test");
163
        sourceTest.edit();
164
        f = sourceTest.findFirst("id=2");
165
        ef = f.getEditable();
166
        ef.set("text", "BB2");
167
        sourceTest.update(ef);
168
        
169
        ef = sourceTest.createNewFeature();
170
        ef.set("id",4);
171
        ef.set("text","DDD");
172
        sourceTest.insert(ef);
173
        sourceTest.finishEditing();
174
        DisposeUtils.disposeQuietly(sourceTest);
175
        r = ws1.commit();
176
        assertEquals("ws1.commit-2 status", ERR_NO_ERROR, r);
177
        
178
        // ------------------------------------------------------------
179
        // Actualizamos (update) la tabla "test" en el workspace2 
180
        // y comprobamos que tiene lo que toca.
181
        r = ws2.updatePrepare("test");
182
        assertEquals("ws2.update-prepare-1 status", 0, r);
183
        VCSGisWorkspaceChanges<VCSGisRepositoryChange> remoteChanges = ws2.getRemoteChanges();
184
        assertEquals("ws2.update-prepare-1 remoteChanges size", 2L, remoteChanges.size64());
185
        
186
        
187
        r = ws2.updatePrepare("test");
188
        assertEquals("ws2.updatePrepare-1 status", 0, r);
189
        r = ws2.update("test");
190
        assertEquals("ws2.update-1 status", 0, r);
191
        store2 = ws2.getFeatureStore("test");
192
        assertEquals("ws2-upfate sizes", 4, store2.size64());
193
        features = store2.getFeatures((Expression)null, "id", true);
194
        assertEquals(1    , features.get(0).getInt("id"));
195
        assertEquals("AAA", features.get(0).getString("text"));
196
        assertEquals(2    , features.get(1).getInt("id"));
197
        assertEquals("BB2", features.get(1).getString("text"));
198
        assertEquals(3    , features.get(2).getInt("id"));
199
        assertEquals("CCC", features.get(2).getString("text"));
200
        assertEquals(4    , features.get(3).getInt("id"));
201
        assertEquals("DDD", features.get(3).getString("text"));
202
        DisposeUtils.disposeQuietly(store2);
203

    
204
        
205
    }
206

    
207
    public void testAuthorizationUserCommitNotAllowed() throws Exception {
208
        final String testid = "AuthorizationUserCommitNotAllowed";
209

    
210
        VCSGisManager manager = VCSGisLocator.getVCSGisManager();
211
        JDBCServerExplorer server = TestUtils.openServerExplorer("srv-"+testid);
212
        File wsfile = TestUtils.getFile(FileUtils.getFile("test-dbs","ws-"+testid)); 
213

    
214
        // ---------------------------------------------------------
215
        // Creamos el respositorio y lo abrimos.
216
        int r = manager.initRepository(server.getParameters(), null);
217
        assertEquals("srv-init status", 0, r);
218

    
219
        VCSGisRepository repo = manager.openRepository(server.getParameters());
220
        TestUtils.h2sql_repository(repo);
221
        
222
        enableAuthentication(repo);
223
        //All allowed except commit
224
        addUser(repo, "user1", "password","add,entities,update,checkout,history,topologyplans,users");
225

    
226
        // ---------------------------------------------------------
227
        // Creamos un workspace y lo abrimos.
228
        r = manager.initWorkspace(wsfile, repo, "Test add and commit",null);
229
        assertEquals("ws-init status", 0, r);
230
        
231
        VCSGisWorkspace ws = manager.openWorkspace(wsfile);
232
        TestUtils.h2sql_workspace(ws);
233
        
234
        ws.setUserIdentificationRequester(getIdentificationRequester("user1", "password"));
235

    
236
        
237
        // ---------------------------------------------------------
238
        // Adicionamos al workspace la tabla de pruebas y lo commitamos
239
        FeatureStore sourceStore = TestUtils.openSourceStore1();
240
        r = ws.add("test", sourceStore, "ID");
241
        assertEquals("ws-add status", 0, r);
242
        
243
        // Intentamos el commit y comprobamos que no está permitido
244
        r = ws.commit();
245
        assertEquals("ws-commit status", ERR_USER_NOT_AUTHORIZED, r);
246
    }
247
    
248

    
249

    
250
    public void testAuthorizationCheckoutNotAllowed() throws Exception {
251
        final String testid = "AuthorizationCheckoutNotAllowed";  ///********************************************
252

    
253
        VCSGisManager manager = VCSGisLocator.getVCSGisManager();
254
        JDBCServerExplorer server = TestUtils.openServerExplorer("srv-"+testid);
255
        File wsfile = TestUtils.getFile(FileUtils.getFile("test-dbs","ws-"+testid)); 
256
        File ws2file = TestUtils.getFile(FileUtils.getFile("test-dbs","ws2-"+testid)); 
257

    
258
        Feature f;
259
        EditableFeature ef;
260
        List<Feature> features;
261
        FeatureStore sourceTest;
262
        FeatureStore store2;
263

    
264
        // ---------------------------------------------------------
265
        // Creamos el respositorio y lo abrimos.
266
        int r = manager.initRepository(server.getParameters(), null);
267
        assertEquals("srv-init status", 0, r);
268

    
269
        VCSGisRepository repo = manager.openRepository(server.getParameters());
270
        TestUtils.h2sql_repository(repo);
271
        
272
        enableAuthentication(repo);
273
        addUser(repo, "user1", "password","add,entities,commit,update,checkout,history,topologyplans,users");
274
        addUser(repo, "user2", "password","add,entities,commit,update,history,topologyplans,users");
275

    
276
        // ---------------------------------------------------------
277
        // Creamos un workspace y lo abrimos.
278
        r = manager.initWorkspace(wsfile, repo, "Test add and commit",null);
279
        assertEquals("ws-init status", 0, r);
280
        
281
        VCSGisWorkspace ws1 = manager.openWorkspace(wsfile);
282
        TestUtils.h2sql_workspace(ws1);
283
        
284
        ws1.setUserIdentificationRequester(getIdentificationRequester("user1", "password"));
285
        
286
        // ---------------------------------------------------------
287
        // Adicionamos al workspace la tabla de pruebas y lo commitamos
288
        sourceTest = TestUtils.openSourceStore2();
289
        r = ws1.add("test", sourceTest, "text");
290
        assertEquals("ws-add status", 0, r);
291
        
292
        r = ws1.commit();
293
        assertEquals("ws-commit status", ERR_OK, r);
294
        
295
        enableAuthorizationByEntity(repo, "test");
296

    
297
        // ---------------------------------------------------------
298
        // Comprobamos que tras el commit la tabla de cambios esta vacia.
299
        FeatureStore changesStore = ws1.getFeatureStore(WorkspaceChangesTable.TABLE_NAME);
300
        assertEquals("Changes", 0, changesStore.size64());
301
        
302
        DisposeUtils.disposeQuietly(changesStore);
303
        
304
        // ---------------------------------------------------------
305
        // Comprobamos que la tabla adicionada al espacio ed trabajo contiene
306
        // los mismos registros que la original.
307
        FeatureStore dataStore = ((VCSGisRepositoryLocaldb)repo).getFeatureStore(DataRepoTable.TABLE_NAME);
308
        assertEquals("DataStore", sourceTest.size64(), dataStore.size64());
309
        
310
        sourceTest.dispose();
311
        DisposeUtils.disposeQuietly(dataStore);
312
        
313
        
314
        // ------------------------------------------------------------
315
        // Inicializamos el workspace2 asociandolo al mismo repositorio que 
316
        // workspace1 y lo abrimos.
317
        r = manager.initWorkspace(ws2file, repo, "Test update2",null);
318
        assertEquals("init_ws2 status", ERR_NO_ERROR, r);
319
        VCSGisWorkspace ws2 = manager.openWorkspace(ws2file);
320
        TestUtils.h2sql_workspace(ws2);
321
        
322
        ws2.setUserIdentificationRequester(getIdentificationRequester("user2", "password"));
323
        
324
        // ------------------------------------------------------------
325
        // Hacemos un checkout en workspace2 de la tabla "test" 
326
        // y comprobamos que tiene lo que toca.
327
        r = ws2.checkout("test");
328
        assertEquals("ws2-checkout status", ERR_USER_NOT_AUTHORIZED, r);
329
       
330
        VCSGisEntity entity = ws2.getWorkspaceEntityByName("test");
331
        assertNull("ws2.update-1 entity", entity);
332
    }
333

    
334
    
335
    public void testAuthorizationCommitByEntityNotAllowed() throws Exception {
336
        final String testid = "AuthorizationCommitByEntityNotAllowed";
337

    
338
        VCSGisManager manager = VCSGisLocator.getVCSGisManager();
339
        JDBCServerExplorer server = TestUtils.openServerExplorer("srv-"+testid);
340
        File wsfile = TestUtils.getFile(FileUtils.getFile("test-dbs","ws-"+testid)); 
341
        File ws2file = TestUtils.getFile(FileUtils.getFile("test-dbs","ws2-"+testid)); 
342

    
343
        Feature f;
344
        EditableFeature ef;
345
        List<Feature> features;
346
        FeatureStore sourceTest;
347
        FeatureStore store2;
348

    
349
        // ---------------------------------------------------------
350
        // Creamos el respositorio y lo abrimos.
351
        int r = manager.initRepository(server.getParameters(), null);
352
        assertEquals("srv-init status", 0, r);
353

    
354
        VCSGisRepository repo = manager.openRepository(server.getParameters());
355
        TestUtils.h2sql_repository(repo);
356
        
357
        enableAuthentication(repo);
358
        addUser(repo, "user1", "password","add,entities,commit,update,checkout,history,topologyplans,users");
359
        addUser(repo, "user2", "password","add,entities,commit,update,checkout,history,topologyplans,users");
360

    
361
        // ---------------------------------------------------------
362
        // Creamos un workspace y lo abrimos.
363
        r = manager.initWorkspace(wsfile, repo, "Test add and commit",null);
364
        assertEquals("ws-init status", 0, r);
365
        
366
        VCSGisWorkspace ws1 = manager.openWorkspace(wsfile);
367
        TestUtils.h2sql_workspace(ws1);
368
        
369
        ws1.setUserIdentificationRequester(getIdentificationRequester("user1", "password"));
370
        
371
        // ---------------------------------------------------------
372
        // Adicionamos al workspace la tabla de pruebas y lo commitamos
373
        sourceTest = TestUtils.openSourceStore2();
374
        r = ws1.add("test", sourceTest, "text");
375
        assertEquals("ws-add status", 0, r);
376
        
377
        r = ws1.commit();
378
        assertEquals("ws-commit status", ERR_OK, r);
379
        
380
        enableAuthorizationByEntity(repo, "test");
381

    
382
        // ---------------------------------------------------------
383
        // Comprobamos que tras el commit la tabla de cambios esta vacia.
384
        FeatureStore changesStore = ws1.getFeatureStore(WorkspaceChangesTable.TABLE_NAME);
385
        assertEquals("Changes", 0, changesStore.size64());
386
        
387
        DisposeUtils.disposeQuietly(changesStore);
388
        
389
        // ---------------------------------------------------------
390
        // Comprobamos que la tabla adicionada al espacio de trabajo contiene
391
        // los mismos registros que la original.
392
        FeatureStore dataStore = ((VCSGisRepositoryLocaldb)repo).getFeatureStore(DataRepoTable.TABLE_NAME);
393
        assertEquals("DataStore", sourceTest.size64(), dataStore.size64());
394
        
395
        sourceTest.dispose();
396
        DisposeUtils.disposeQuietly(dataStore);
397
        
398
        
399
        // ------------------------------------------------------------
400
        // Inicializamos el workspace2 asociandolo al mismo repositorio que 
401
        // workspace1 y lo abrimos.
402
        r = manager.initWorkspace(ws2file, repo, "Test update2",null);
403
        assertEquals("init_ws2 status", ERR_NO_ERROR, r);
404
        VCSGisWorkspace ws2 = manager.openWorkspace(ws2file);
405
        TestUtils.h2sql_workspace(ws2);
406
        
407
        ws2.setUserIdentificationRequester(getIdentificationRequester("user2", "password"));
408
        
409
        // ------------------------------------------------------------
410
        // Hacemos un checkout en workspace2 de la tabla "test" 
411
        // y comprobamos que tiene lo que toca.
412
        r = ws2.checkout("test");
413
        assertEquals("ws2-checkout status", ERR_NO_ERROR, r);
414
       
415
        VCSGisEntity entity = ws2.getWorkspaceEntityByName("test");
416
        assertNotNull("ws2.update-1 entity", entity);
417
        assertEquals("ws2.update-1 label", "text", entity.getFieldForLabel());
418

    
419
        store2 = ws2.getFeatureStore("test");
420
        assertEquals("ws2-checkout sizes", 3, store2.size64());
421
        features = store2.getFeatures((Expression)null, "id", true);
422
        assertEquals(1    , features.get(0).getInt("id"));
423
        assertEquals("AAA", features.get(0).getString("text"));
424
        assertEquals(2    , features.get(1).getInt("id"));
425
        assertEquals("BBB", features.get(1).getString("text"));
426
        assertEquals(3    , features.get(2).getInt("id"));
427
        assertEquals("CCC", features.get(2).getString("text"));
428
        
429
        DisposeUtils.disposeQuietly(store2);
430
        
431
        
432
        // ------------------------------------------------------------
433
        // Modificamos la tabla "test" en el workspace2, la commitamos y comprobamos que no hay permisos para hacerlo.
434
        sourceTest = ws2.getFeatureStore("test");
435
        sourceTest.edit();
436
        f = sourceTest.findFirst("id=2");
437
        ef = f.getEditable();
438
        ef.set("text", "BB2");
439
        sourceTest.update(ef);
440
        
441
        ef = sourceTest.createNewFeature();
442
        ef.set("id",4);
443
        ef.set("text","DDD");
444
        sourceTest.insert(ef);
445
        sourceTest.finishEditing();
446
        DisposeUtils.disposeQuietly(sourceTest);
447
        r = ws2.commit();
448
        assertEquals("ws2.commit-1 status", ERR_USER_NOT_AUTHORIZED, r);
449
        
450
        DisposeUtils.disposeQuietly(store2);
451
        
452
    }
453
    
454
    
455
    
456

    
457

    
458
    
459
    
460
    private void enableAuthentication(VCSGisRepository repo){
461
        ConfigRepoTable varsTable = new ConfigRepoTable();
462
        varsTable.set((VCSGisRepositoryLocaldb) repo, "AUTHENTICATION", String.valueOf(true));
463
        varsTable.set((VCSGisRepositoryLocaldb) repo, "AUTHORIZATION", String.valueOf(true));
464
        
465
    }
466

    
467
    private void addUser(VCSGisRepository repo, String userId, String password, String roles) {
468
        UsersRepoTable.UserRepoRow userRow = new UsersRepoTable.UserRepoRow((VCSGisRepositoryLocaldb) repo);
469
        userRow.setIdentifier(userId);
470
        userRow.setPassword(password);
471
        userRow.setAllowedOperations(roles);
472
        userRow.insert();
473
    }
474
    
475
    private void enableAuthorizationByEntity(VCSGisRepository repo, String entityName){
476

    
477
        EntitiesRepoTable table = new EntitiesRepoTable();
478
        EntitiesRepoTable.EntityRepoRow entityRow = table.getByEntityName((VCSGisRepositoryLocaldb) repo, entityName);
479

    
480
        entityRow.setAuthorizations("{"
481
                + "  \"entities\": [ \"user1\", \"user2\"],"
482
                + "  \"commit\": [ \"user1\" ],"
483
                + "  \"update\": [ \"user1\", \"user2\"],"
484
                + "  \"checkout\": [ \"user1\", \"user2\"],"
485
                + "  \"history\": [ \"user1\" ],\n"
486
                + "  \"topologyplans\": [ \"user1\", \"user2\"],"
487
                + "  \"users\": [ \"user1\", \"user2\"]"
488
                + "}");
489
        
490

    
491
        entityRow.update();
492

    
493
    }
494
    
495
    VCSGisUserIdentificationRequester getIdentificationRequester(String userId, String password) {
496
        return new VCSGisUserIdentificationRequester() {
497
            int retries = 0;
498
            @Override
499
            public boolean requestIdentification() {
500
                if(retries++ > 5){
501
                    return false;
502
                }
503
                return true;
504
            }
505

    
506
            @Override
507
            public String getUserId() {
508
                return userId;
509
            }
510

    
511
            @Override
512
            public String getPassword() {
513
                return password;
514
            }
515
        };
516
    }
517
        
518
}