Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.sip.security
Class CredentialsCache

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.sip.security.CredentialsCache

 class CredentialsCache
extends Object

The class is used to cache all realms that a certain call has been authorized against and all credentials that have been used for each realm. Note that rfc3261 suggests keeping callId->credentials mapping where as we map realm->credentials. This is done to avoid asking the user for a password before each call.

Version:
1.0
Author:
Emil Ivov, Nie Pin

Constructor Summary
CredentialsCache()
           
 
Method Summary
(package private)  void cacheAuthorizationHeader(String callid, javax.sip.header.AuthorizationHeader authorization)
          Cache the bindings of call-id and authorization header.
(package private)  void cacheEntry(String realm, CredentialsCacheEntry cacheEntry)
          Cache credentials for the specified call and realm
(package private)  void clear()
          Empty the credentials cache (all authorization challenges) would end up requesting a password from the user.
(package private)  CredentialsCacheEntry get(String realm)
          Returns the credentials corresponding to the specified realm or null if none could be found.
(package private)  javax.sip.header.AuthorizationHeader getCachedAuthorizationHeader(String callid)
          Returns an authorization header cached for the specified call id and null if no authorization header has been previously cached for this call.
(package private)  List<String> getRealms(String branchID)
          Returns the list of realms that branchID has been used to authenticate against.
(package private)  CredentialsCacheEntry remove(String realm)
          Returns the credentials corresponding to the specified realm or null if none could be found and removes the entry from the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CredentialsCache

CredentialsCache()
Method Detail

cacheEntry

void cacheEntry(String realm,
                CredentialsCacheEntry cacheEntry)
Cache credentials for the specified call and realm

Parameters:
realm - the realm that the specify credentials apply to
cacheEntry - the credentials

get

CredentialsCacheEntry get(String realm)
Returns the credentials corresponding to the specified realm or null if none could be found.

Parameters:
realm - the realm that the credentials apply to
Returns:
the credentials corresponding to the specified realm or null if none could be found.

getRealms

List<String> getRealms(String branchID)
Returns the list of realms that branchID has been used to authenticate against.

Parameters:
branchID - the transaction branchID that we are looking for.
Returns:
the list of realms that branchID has been used to authenticate against.

remove

CredentialsCacheEntry remove(String realm)
Returns the credentials corresponding to the specified realm or null if none could be found and removes the entry from the cache.

Parameters:
realm - the realm that the credentials apply to
Returns:
the credentials corresponding to the specified realm or null if none could be found.

clear

void clear()
Empty the credentials cache (all authorization challenges) would end up requesting a password from the user.


cacheAuthorizationHeader

void cacheAuthorizationHeader(String callid,
                              javax.sip.header.AuthorizationHeader authorization)
Cache the bindings of call-id and authorization header.

Parameters:
callid - the id of the call that the authorization header belongs to.
authorization - the authorization header that we'd like to cache.

getCachedAuthorizationHeader

javax.sip.header.AuthorizationHeader getCachedAuthorizationHeader(String callid)
Returns an authorization header cached for the specified call id and null if no authorization header has been previously cached for this call.

Parameters:
callid - the call id that we'd like to retrive a cached authorization header for.
Returns:
authorization header corresponding to the specified callid

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.