public class CredentialsManager extends Object
CredentialsAuthority
implementation. The point of this mechanism
is to allow use in both applications that would handle large numbers of
possible users (such as STUN/TURN servers) or others that would only work
with a few, like for example an ICE implementation.
TODO: just throwing a user name at the manager and expecting it to find
an authority that knows about it may lead to ambiguities so we may need
to add other parameters in here that would allow us to better select an
authority.Modifier and Type | Field and Description |
---|---|
private List<CredentialsAuthority> |
authorities
The list of CredentialsAuthoritys registered with this manager
as being able to provide credentials.
|
private CredentialsAuthority[] |
unmodifiableAuthorities
The list of CredentialsAuthoritys registered with this manager
as being able to provide credentials.
|
Constructor and Description |
---|
CredentialsManager() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkLocalUserName(String username)
Verifies whether username is currently known to any of the
CredentialsAuthority s registered with this manager and
and returns true if so. |
private CredentialsAuthority[] |
getAuthorities()
Gets the list of CredentialsAuthoritys registered with this
manager as being able to provide credentials.
|
byte[] |
getLocalKey(String username)
Queries all currently registered
CredentialsAuthority s for a
password corresponding to the specified local username or user
frag and returns the first non-null one. |
byte[] |
getRemoteKey(String username,
String media)
Queries all currently registered
CredentialsAuthority s for a
password corresponding to the specified remote username or user
frag and returns the first non-null one. |
void |
registerAuthority(CredentialsAuthority authority)
Adds authority to the list of
CredentialsAuthority s
registered with this manager. |
void |
unregisterAuthority(CredentialsAuthority authority)
Removes authority from the list of
CredentialsAuthority s
registered with this manager. |
private final List<CredentialsAuthority> authorities
private CredentialsAuthority[] unmodifiableAuthorities
authorities
. The field was introduced in
order to reduce the scopes of the synchronization blocks of
CredentialsManager and to thus reduce the risks of deadlocks.public boolean checkLocalUserName(String username)
CredentialsAuthority
s registered with this manager and
and returns true if so. Returns false otherwise.username
- the user name whose validity we'd like to check.private CredentialsAuthority[] getAuthorities()
public byte[] getLocalKey(String username)
CredentialsAuthority
s for a
password corresponding to the specified local username or user
frag and returns the first non-null one.username
- a local user name or user frag whose credentials we'd
like to obtain.public byte[] getRemoteKey(String username, String media)
CredentialsAuthority
s for a
password corresponding to the specified remote username or user
frag and returns the first non-null one.username
- a remote user name or user frag whose credentials we'd
like to obtain.media
- the media name that we want to get remote key.public void registerAuthority(CredentialsAuthority authority)
CredentialsAuthority
s
registered with this manager.authority
- the CredentialsAuthority
to add to this manager.public void unregisterAuthority(CredentialsAuthority authority)
CredentialsAuthority
s
registered with this manager.authority
- the CredentialsAuthority
to remove from this
manager.Copyright © 2018. All rights reserved.