com.perforce.p4java.server
Class AbstractAuthHelper

java.lang.Object
  extended by com.perforce.p4java.server.AbstractAuthHelper
Direct Known Subclasses:
AuthTicketsHelper, FingerprintsHelper

public abstract class AbstractAuthHelper
extends Object

This super class is designed to lookup auth entries from file or memory.


Field Summary
protected static String AUTH_VALUE_MAP_KEY
           
protected static String SERVER_ADDRESS_MAP_KEY
           
protected static String USER_NAME_MAP_KEY
           
 
Constructor Summary
AbstractAuthHelper()
           
 
Method Summary
protected static List<Map<String,String>> getFileEntries(File authFile)
          Get all the auth entries found in the specified auth file.
protected static List<Map<String,String>> getMemoryEntries(Map<String,String> authMap)
          Get all the auth entries found in the specified auth store in memory.
protected static Map<String,String> getMemoryEntry(String userName, String serverAddress, Map<String,String> authMap)
          Get the auth entry in the specified auth map that matches the specified user name and server address.
protected static void saveFileEntry(String userName, String serverAddress, String authValue, File authFile)
          Save the specified parameters as an entry into the specified auth file.
protected static void saveMemoryEntry(String userName, String serverAddress, String authValue, Map<String,String> authMap)
          Save the specified parameters as an entry into the specified auth map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_ADDRESS_MAP_KEY

protected static final String SERVER_ADDRESS_MAP_KEY
See Also:
Constant Field Values

USER_NAME_MAP_KEY

protected static final String USER_NAME_MAP_KEY
See Also:
Constant Field Values

AUTH_VALUE_MAP_KEY

protected static final String AUTH_VALUE_MAP_KEY
See Also:
Constant Field Values
Constructor Detail

AbstractAuthHelper

public AbstractAuthHelper()
Method Detail

getMemoryEntry

protected static Map<String,String> getMemoryEntry(String userName,
                                                   String serverAddress,
                                                   Map<String,String> authMap)
Get the auth entry in the specified auth map that matches the specified user name and server address. The user name be non-null and the server address must be non-null and be of the form server:port.

Parameters:
authMap -
Returns:
- list of auth entries found in the specified auth map

getMemoryEntries

protected static List<Map<String,String>> getMemoryEntries(Map<String,String> authMap)
Get all the auth entries found in the specified auth store in memory.

Parameters:
authMap -
Returns:
- list of auth entries found in the specified auth map

saveMemoryEntry

protected static void saveMemoryEntry(String userName,
                                      String serverAddress,
                                      String authValue,
                                      Map<String,String> authMap)
Save the specified parameters as an entry into the specified auth map. This method will add or replace the current entry for the user name and server address in the auth map. If the specified auth value is null then the current entry (if exits) in the specified map will be removed.

Parameters:
userName - - non-null user name
serverAddress - - non-null server address
authValue - - possibly null auth value
authMap - - non-null auth map

getFileEntries

protected static List<Map<String,String>> getFileEntries(File authFile)
                                                  throws IOException
Get all the auth entries found in the specified auth file.

Parameters:
authFile -
Returns:
- list of auth entries found in the specified auth file
Throws:
IOException - - io exception from reading auth file

saveFileEntry

protected static void saveFileEntry(String userName,
                                    String serverAddress,
                                    String authValue,
                                    File authFile)
                             throws IOException
Save the specified parameters as an entry into the specified auth file. This method will replace the current entry for the user name and server address in the auth file. If a current entry is not found then the specified entry will be appended to the file. If the specified auth value is null then the current entry in the specified file will be removed if found.

Parameters:
userName - - non-null user name
serverAddress - - non-null server address
authValue - - possibly null auth value
authFile - - non-null file
Throws:
IOException


Copyright © 2015 Perforce Software. All Rights Reserved.