-
Notifications
You must be signed in to change notification settings - Fork 138
/
Realm.java
779 lines (670 loc) · 27.5 KB
/
Realm.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package com.sun.enterprise.security.auth.realm;
import static com.sun.enterprise.security.SecurityLoggerInfo.realmCreated;
import static java.util.logging.Level.INFO;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.logging.Logger;
import org.glassfish.external.probe.provider.PluginPoint;
import org.glassfish.external.probe.provider.StatsProviderManager;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.internal.api.ClassLoaderHierarchy;
import org.glassfish.internal.api.Globals;
import org.jvnet.hk2.annotations.Contract;
import com.sun.enterprise.security.BaseRealm;
import com.sun.enterprise.security.SecurityLoggerInfo;
import com.sun.enterprise.security.util.IASSecurityException;
import com.sun.enterprise.util.LocalStringManagerImpl;
/**
* javadoc
*
* @see java.security.Principal
*
* @author Harish Prabandham
* @author Harpreet Singh
* @author Jyri Virkki
* @author Shing Wai Chan
*
*/
@Contract
public abstract class Realm implements Comparable {
private static LocalStringManagerImpl localStrings = new LocalStringManagerImpl(Realm.class);
private String myName;
// Keep a mapping from "default" to default realm (if no such named
// realm is present) for the sake of all the hardcoded accesses to it.
// This needs to be removed as part of RI security service cleanup.
final static String RI_DEFAULT = "default";
// All realms have a set of properties from config file, consolidate.
private final Properties ctxProps;
// for assign-groups
private static final String PARAM_GROUPS = "assign-groups";
private static final String GROUPS_SEP = ",";
private List<String> assignGroups = null;
public static final String PARAM_GROUP_MAPPING = "group-mapping";
protected GroupMapper groupMapper = null;
private static RealmStatsProvider realmStatsProvier = null;
private static final String DEFAULT_DIGEST_ALGORITHM = "default-digest-algorithm";
private static final String DEFAULT_DEF_DIG_ALGO_VAL = "SHA-256";
private static WeakReference<RealmsManager> realmsManager = new WeakReference<>(null);
private String defaultDigestAlgorithm = null;
protected static final Logger _logger = SecurityLoggerInfo.getLogger();
/**
* The default constructor creates a realm which will later be initialized, either from properties or by deserializing.
*/
protected Realm() {
ctxProps = new Properties();
}
/**
* Returns the name of this realm.
*
* @return realm name.
*/
public final String getName() {
return myName;
}
protected String getDefaultDigestAlgorithm() {
return defaultDigestAlgorithm;
}
/**
* Assigns the name of this realm, and stores it in the cache of realms. Used when initializing a newly created
* in-memory realm object; if the realm already has a name, there is no effect.
*
* @param name name to be assigned to this realm.
*/
protected final void setName(String name) {
if (myName != null) {
return;
}
myName = name;
}
/**
* Instantiate a Realm with the given name and properties using the Class name given. This method is used by iAS and not
* RI.
*
* @param name Name of the new realm.
* @param className Java Class name of the realm to create.
* @param props Properties containing values of the Property element from server.xml
* @returns Reference to the new Realm. The Realm class keeps an internal list of all instantiated realms.
* @throws BadRealmException If the requested realm cannot be instantiated.
*
*/
public static synchronized Realm instantiate(String name, String className, Properties props) throws BadRealmException {
// Register the realm provider
registerRealmStatsProvier();
Realm realmClass = _getInstance(name);
if (realmClass == null) {
realmClass = doInstantiate(name, className, props);
getRealmsManager().putIntoLoadedRealms(name, realmClass);
}
return realmClass;
}
/**
* Instantiate a Realm with the given name and properties using the Class name given. This method is used by iAS and not
* RI.
*
* @param name Name of the new realm.
* @param className Java Class name of the realm to create.
* @param props Properties containing values of the Property element from server.xml
* @param configName the config to which this realm belongs
* @returns Reference to the new Realm. The Realm class keeps an internal list of all instantiated realms.
* @throws BadRealmException If the requested realm cannot be instantiated.
*
*/
public static synchronized Realm instantiate(String name, String className, Properties props, String configName) throws BadRealmException {
// Register the realm provider
registerRealmStatsProvier();
Realm realmClass = _getInstance(configName, name);
if (realmClass == null) {
realmClass = doInstantiate(name, className, props);
getRealmsManager().putIntoLoadedRealms(configName, name, realmClass);
}
return realmClass;
}
public static synchronized void getRealmStatsProvier() {
if (realmStatsProvier == null) {
realmStatsProvier = new RealmStatsProvider();
}
}
/**
* Instantiate a Realm with the given name, loading properties from the given file. This method is only used by RI and
* is not called anywhere in iAS. Note : this method stands unused in V3.1 but keeping it since it is a public method.
*
* @deprecated
* @param realmName Name of the new realm.
* @param f File containing Properties for the new realm.
*/
@Deprecated
public static synchronized Realm instantiate(String realmName, File f) throws NoSuchRealmException, BadRealmException, FileNotFoundException {
if (!f.exists() || !f.isFile()) {
throw new FileNotFoundException();
}
if (_getInstance(realmName) != null) {
throw new BadRealmException(localStrings.getLocalString("realm.already_exists", "This Realm already exists."));
}
//
// First load the description from properties.
//
InputStream in = null;
Properties props = new Properties();
try {
in = new FileInputStream(f);
props.load(in);
//
// Then instantiate and initialize, using the single mandatory
// property ("classname").
//
String classname = props.getProperty("classname");
assert (classname != null);
return doInstantiate(realmName, classname, props);
} catch (IOException e) {
throw new BadRealmException(e.toString());
} finally {
if (in != null) {
try {
in.close();
} catch (Exception ex) {
}
}
}
}
/**
* Replace a Realm instance. Can be used by a Realm subclass to replace a previously initialized instance of itself.
* Future getInstance requests will then obtain the new instance.
*
* <P>
* Minimal error checking is done. The realm being replaced must already exist (instantiate() was previously called),
* the new instance must be fully initialized properly and it must of course be of the same class as the previous
* instance.
*
* @param realm The new realm instance.
* @param name The (previously instantiated) name for this realm.
*
*/
protected static synchronized void updateInstance(Realm realm, String name) {
RealmsManager realmsManager = getNonNullRealsManager();
Realm oldRealm = realmsManager.getFromLoadedRealms(name);
if (!oldRealm.getClass().equals(realm.getClass())) {
// would never happen unless bug in realm subclass
throw new Error("Incompatible class " + realm.getClass() + " in replacement realm " + name);
}
realm.setName(oldRealm.getName());
realmsManager.putIntoLoadedRealms(name, realm);
_logger.log(INFO, SecurityLoggerInfo.realmUpdated, new Object[] { realm.getName() });
}
/**
* Replace a Realm instance. Can be used by a Realm subclass to replace a previously initialized instance of itself.
* Future getInstance requests will then obtain the new instance.
*
* <P>
* Minimal error checking is done. The realm being replaced must already exist (instantiate() was previously called),
* the new instance must be fully initialized properly and it must of course be of the same class as the previous
* instance.
*
* @param realm The new realm instance.
* @param name The (previously instantiated) name for this realm.
*
*/
protected static synchronized void updateInstance(String configName, Realm realm, String name) {
RealmsManager realmsManager = getNonNullRealsManager();
Realm oldRealm = realmsManager.getFromLoadedRealms(configName, name);
if (!oldRealm.getClass().equals(realm.getClass())) {
// would never happen unless bug in realm subclass
throw new Error("Incompatible class " + realm.getClass() + " in replacement realm " + name);
}
realm.setName(oldRealm.getName());
realmsManager.putIntoLoadedRealms(configName, name, realm);
_logger.log(INFO, SecurityLoggerInfo.realmUpdated, new Object[] { realm.getName() });
}
/**
* Convenience method which returns the Realm object representing the current default realm. Equivalent to
* getInstance(getDefaultRealm()).
*
* @return Realm representing default realm.
* @exception NoSuchRealmException if default realm does not exist
*/
public static synchronized Realm getDefaultInstance() throws NoSuchRealmException {
return getInstance(getDefaultRealm());
}
/**
* Returns the name of the default realm.
*
* @return Default realm name.
*
*/
public static synchronized String getDefaultRealm() {
return getNonNullRealsManager().getDefaultRealmName();
}
/**
* Sets the name of the default realm.
*
* @param realmName Name of realm to set as default.
*
*/
public static synchronized void setDefaultRealm(String realmName) {
getNonNullRealsManager().setDefaultRealmName(realmName);
}
/**
* Remove realm with given name from cache.
*
* @param realmName
* @exception NoSuchRealmException
*/
public static synchronized void unloadInstance(String realmName) throws NoSuchRealmException {
// make sure instance exist
getInstance(realmName);
getNonNullRealsManager().removeFromLoadedRealms(realmName);
_logger.log(INFO, SecurityLoggerInfo.realmDeleted, realmName);
}
/**
* Remove realm with given name from cache.
*
* @param realmName
* @exception NoSuchRealmException
*/
public static synchronized void unloadInstance(String configName, String realmName) throws NoSuchRealmException {
getNonNullRealsManager().removeFromLoadedRealms(configName, realmName);
_logger.log(INFO, SecurityLoggerInfo.realmDeleted, realmName);
}
/**
* Set a realm property.
*
* @param name property name.
* @param value property value.
*
*/
public synchronized void setProperty(String name, String value) {
ctxProps.setProperty(name, value);
}
/**
* Get a realm property.
*
* @param name property name.
* @returns value.
*
*/
public synchronized String getProperty(String name) {
return ctxProps.getProperty(name);
}
/**
* Return properties of the realm.
*/
protected synchronized Properties getProperties() {
return ctxProps;
}
/**
* Returns name of JAAS context used by this realm.
*
* <P>
* The JAAS context is defined in server.xml auth-realm element associated with this realm.
*
* @return String containing JAAS context name.
*
*/
public synchronized String getJAASContext() {
return ctxProps.getProperty(BaseRealm.JAAS_CONTEXT_PARAM);
}
/**
* Returns the realm identified by the name which is passed as a parameter. This function knows about all the realms
* which exist; it is not possible to store (or create) one which is not accessible through this routine.
*
* @param name identifies the realm
* @return the requested realm
* @exception NoSuchRealmException if the realm is invalid
* @exception BadRealmException if realm data structures are bad
*/
public static synchronized Realm getInstance(String name) throws NoSuchRealmException {
Realm instance = _getInstance(name);
if (instance == null) {
throw new NoSuchRealmException(localStrings.getLocalString("realm.no_such_realm", name + " realm does not exist.", new Object[] { name }));
}
return instance;
}
/**
* Returns the realm identified by the name which is passed as a parameter. This function knows about all the realms
* which exist; it is not possible to store (or create) one which is not accessible through this routine.
*
* @param name identifies the realm
* @return the requested realm
* @exception NoSuchRealmException if the realm is invalid
* @exception BadRealmException if realm data structures are bad
*/
public static synchronized Realm getInstance(String configName, String name) throws NoSuchRealmException {
Realm instance = _getInstance(configName, name);
if (instance == null) {
throw new NoSuchRealmException(localStrings.getLocalString("realm.no_such_realm", name + " realm does not exist.", new Object[] { name }));
}
return instance;
}
/**
* Checks if the given realm name is loaded/valid.
*
* @param String name of the realm to check.
* @return true if realm present, false otherwise.
*/
public static boolean isValidRealm(String name) {
return getNonNullRealsManager().isValidRealm(name);
}
/**
* Checks if the given realm name is loaded/valid.
*
* @param String name of the realm to check.
* @return true if realm present, false otherwise.
*/
public static boolean isValidRealm(String configName, String name) {
return getNonNullRealsManager().isValidRealm(configName, name);
}
/**
* Returns the names of accessible realms.
*
* @return set of realm names
*/
public static synchronized Enumeration<String> getRealmNames() {
return getNonNullRealsManager().getRealmNames();
}
/**
* Returns the name of this realm.
*
* @return name of realm.
*/
@Override
public String toString() {
return myName;
}
/**
* Compares a realm to another. The comparison first considers the authentication type, so that realms supporting the
* same kind of user authentication are grouped together. Then it compares realm realm names. Realms compare "before"
* other kinds of objects (i.e. there's only a partial order defined, in the case that those other objects compare
* themselves "before" a realm object).
*/
@Override
public int compareTo(Object realm) {
if (!(realm instanceof Realm)) {
return 1;
}
Realm r = (Realm) realm;
String str = r.getAuthType();
int temp;
if ((temp = getAuthType().compareTo(str)) != 0) {
return temp;
}
str = r.getName();
return getName().compareTo(str);
}
/**
* Initialize a realm with some properties. This can be used when instantiating realms from their descriptions. This
* method may only be called a single time.
*
* @param props initialization parameters used by this realm.
* @exception BadRealmException if the configuration parameters identify a corrupt realm
* @exception NoSuchRealmException if the configuration parameters specify a realm which doesn't exist
*/
protected void init(Properties props) throws BadRealmException, NoSuchRealmException {
String groupList = props.getProperty(PARAM_GROUPS);
if (groupList != null && groupList.length() > 0) {
this.setProperty(PARAM_GROUPS, groupList);
assignGroups = new ArrayList<>();
StringTokenizer st = new StringTokenizer(groupList, GROUPS_SEP);
while (st.hasMoreTokens()) {
String grp = st.nextToken();
if (!assignGroups.contains(grp)) {
assignGroups.add(grp);
}
}
}
String groupMapping = props.getProperty(PARAM_GROUP_MAPPING);
if (groupMapping != null) {
groupMapper = new GroupMapper();
groupMapper.parse(groupMapping);
}
String defaultDigestAlgo = null;
if (_getRealmsManager() != null) {
defaultDigestAlgo = _getRealmsManager().getDefaultDigestAlgorithm();
}
this.defaultDigestAlgorithm = (defaultDigestAlgo == null) ? DEFAULT_DEF_DIG_ALGO_VAL : defaultDigestAlgo;
}
/**
* Add assign groups to given Vector of groups. To be used by getGroupNames.
*
* @param grps
*/
protected String[] addAssignGroups(String[] grps) {
String[] resultGroups = grps;
if (assignGroups != null && assignGroups.size() > 0) {
List<String> groupList = new ArrayList<>();
if (grps != null && grps.length > 0) {
for (String grp : grps) {
groupList.add(grp);
}
}
for (String agrp : assignGroups) {
if (!groupList.contains(agrp)) {
groupList.add(agrp);
}
}
resultGroups = groupList.toArray(new String[groupList.size()]);
}
return resultGroups;
}
protected List<String> getMappedGroupNames(String group) {
if (groupMapper == null) {
return null;
}
List<String> mappedGroupNames = new ArrayList<>();
groupMapper.getMappedGroups(group, mappedGroupNames);
return mappedGroupNames;
}
// ### Private static methods
/**
* Instantiates a Realm class of the given type and invokes its init()
*
*/
private static synchronized Realm doInstantiate(String name, String className, Properties props) throws BadRealmException {
ServiceLocator serviceLocator = Globals.getDefaultBaseServiceLocator();
RealmsManager realmsManager = null;
try {
realmsManager = getRealmsManager();
// Try a HK2 route first
Realm realm = serviceLocator.getService(Realm.class, name);
if (realm == null) {
try {
// TODO: workaround here. Once fixed in V3 we should be able to use
// Context ClassLoader instead.
realm = (Realm) serviceLocator.getService(ClassLoaderHierarchy.class)
.getCommonClassLoader()
.loadClass(className)
.getDeclaredConstructor()
.newInstance();
} catch (IllegalArgumentException | ReflectiveOperationException | SecurityException ex) {
realm = (Realm) Class.forName(className)
.getDeclaredConstructor()
.newInstance();
}
}
realm.setName(name);
realm.init(props);
if (realmsManager == null) {
throw new BadRealmException("Unable to locate RealmsManager Service");
}
_logger.log(INFO, realmCreated, new Object[] { name, className });
return realm;
} catch (NoSuchRealmException | ReflectiveOperationException ex) {
throw new BadRealmException(ex);
}
}
private static void registerRealmStatsProvier() {
if (realmStatsProvier == null) {
getRealmStatsProvier();
StatsProviderManager.register("security", PluginPoint.SERVER, "security/realm", realmStatsProvier);
}
}
/**
* This is a private method for getting realm instance. If realm does not exist, then it will not return null rather
* than throw exception.
*
* @param name identifies the realm
* @return the requested realm
*/
private static synchronized Realm _getInstance(String name) {
return getNonNullRealsManager()._getInstance(name);
}
/**
* This is a private method for getting realm instance. If realm does not exist, then it will not return null rather
* than throw exception.
*
* @param name identifies the realm
* @return the requested realm
*/
private static synchronized Realm _getInstance(String configName, String name) {
return getNonNullRealsManager()._getInstance(configName, name);
}
private static RealmsManager getNonNullRealsManager() {
RealmsManager realmsManager = getRealmsManager();
if (realmsManager == null) {
throw new RuntimeException("Unable to locate RealmsManager Service");
}
return realmsManager;
}
private static RealmsManager getRealmsManager() {
if (realmsManager.get() != null) {
return realmsManager.get();
}
return _getRealmsManager();
}
private static synchronized RealmsManager _getRealmsManager() {
if (realmsManager.get() == null) {
if (Globals.getDefaultHabitat() != null) {
realmsManager = new WeakReference<>(Globals.get(RealmsManager.class));
} else {
return null;
}
}
return realmsManager.get();
}
// ---[ Abstract methods ]------------------------------------------------
/**
* Returns a short (preferably less than fifteen characters) description of the kind of authentication which is
* supported by this realm.
*
* @return description of the kind of authentication that is directly supported by this realm.
*/
public abstract String getAuthType();
/**
* Returns an AuthenticationHandler object which can be used to authenticate within this realm.
*
* @return An AuthenticationHandler object for this realm.
*/
public abstract AuthenticationHandler getAuthenticationHandler();
/**
* Returns names of all the users in this particular realm.
*
* @return enumeration of user names (strings)
* @exception BadRealmException if realm data structures are bad
*/
public abstract Enumeration getUserNames() throws BadRealmException;
/**
* Returns the information recorded about a particular named user.
*
* @param name name of the user whose information is desired
* @return the user object
* @exception NoSuchUserException if the user doesn't exist
* @exception BadRealmException if realm data structures are bad
*/
public abstract User getUser(String name) throws NoSuchUserException, BadRealmException;
/**
* Returns names of all the groups in this particular realm.
*
* @return enumeration of group names (strings)
* @exception BadRealmException if realm data structures are bad
*/
public abstract Enumeration<String> getGroupNames() throws BadRealmException;
/**
* Returns the name of all the groups that this user belongs to
*
* @param username name of the user in this realm whose group listing is needed.
* @return enumeration of group names (strings)
* @exception InvalidOperationException thrown if the realm does not support this operation - e.g. Certificate realm
* does not support this operation
*/
public abstract Enumeration<String> getGroupNames(String username) throws InvalidOperationException, NoSuchUserException;
/**
* Refreshes the realm data so that new users/groups are visible.
*
* @exception BadRealmException if realm data structures are bad
*/
public abstract void refresh() throws BadRealmException;
/**
* Refreshes the realm data so that new users/groups are visible.
*
* @exception BadRealmException if realm data structures are bad
*/
public void refresh(String configName) throws BadRealmException {
// do nothing
}
/**
* Adds new user to file realm. User cannot exist already.
*
* @param name User name.
* @param password Cleartext password for the user.
* @param groupList List of groups to which user belongs.
* @throws BadRealmException If there are problems adding user.
*
*/
public abstract void addUser(String name, char[] password, String[] groupList) throws BadRealmException, IASSecurityException;
/**
* Remove user from file realm. User must exist.
*
* @param name User name.
* @throws NoSuchUserException If user does not exist.
*
*/
public abstract void removeUser(String name) throws NoSuchUserException, BadRealmException;
/**
* Update data for an existing user. User must exist.
*
* @param name Current name of the user to update.
* @param newName New name to give this user. It can be the same as the original name. Otherwise it must be a new user
* name which does not already exist as a user.
* @param password Cleartext password for the user. If non-null the user password is changed to this value. If null, the
* original password is retained.
* @param groupList List of groups to which user belongs.
*
* @throws BadRealmException If there are problems adding user.
* @throws NoSuchUserException If user does not exist.
*
*/
public abstract void updateUser(String name, String newName, char[] password, String[] groups) throws NoSuchUserException, BadRealmException, IASSecurityException;
/**
* @return true if the realm implementation support User Management (add,remove,update user)
*/
public abstract boolean supportsUserManagement();
/**
* Persist the realm data to permanent storage
*
* @throws com.sun.enterprise.security.auth.realm.BadRealmException
*/
public abstract void persist() throws BadRealmException;
}