Fix a possible ConcurrentModificationException in CredentialsManager.
This commit is contained in:
parent
17e931572e
commit
768db27837
@ -46,6 +46,8 @@ public class CredentialsManager
|
||||
* that one of them returned.
|
||||
*/
|
||||
public byte[] getLocalKey(String username)
|
||||
{
|
||||
synchronized(authorities)
|
||||
{
|
||||
for (CredentialsAuthority auth : authorities)
|
||||
{
|
||||
@ -56,7 +58,7 @@ public class CredentialsManager
|
||||
return passwd;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -75,6 +77,8 @@ public class CredentialsManager
|
||||
* that one of them returned.
|
||||
*/
|
||||
public byte[] getRemoteKey(String username, String media)
|
||||
{
|
||||
synchronized(authorities)
|
||||
{
|
||||
for (CredentialsAuthority auth : authorities)
|
||||
{
|
||||
@ -86,7 +90,7 @@ public class CredentialsManager
|
||||
return passwd;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -102,13 +106,15 @@ public class CredentialsManager
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean checkLocalUserName(String username)
|
||||
{
|
||||
synchronized(authorities)
|
||||
{
|
||||
for (CredentialsAuthority auth : authorities)
|
||||
{
|
||||
if( auth.checkLocalUserName(username))
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -119,10 +125,13 @@ public class CredentialsManager
|
||||
* @param authority the {@link CredentialsAuthority} to add to this manager.
|
||||
*/
|
||||
public void registerAuthority(CredentialsAuthority authority)
|
||||
{
|
||||
synchronized(authorities)
|
||||
{
|
||||
if(!authorities.contains(authority))
|
||||
authorities.add(authority);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes <tt>authority</tt> from the list of {@link CredentialsAuthority}s
|
||||
@ -132,7 +141,10 @@ public class CredentialsManager
|
||||
* manager.
|
||||
*/
|
||||
public void unregisterAuthority(CredentialsAuthority authority)
|
||||
{
|
||||
synchronized(authorities)
|
||||
{
|
||||
authorities.remove(authority);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user