com.eurotech.framework.net.admin.visitor.linux.util
Class PppAuthSecrets

java.lang.Object
  extended by com.eurotech.framework.net.admin.visitor.linux.util.PppAuthSecrets
Direct Known Subclasses:
ChapLinux, PapLinux

public class PppAuthSecrets
extends Object

Defines PAP/CHAP authentication in Linux

Author:
ilya.binshtok

Constructor Summary
PppAuthSecrets(String secretsFilename)
          PppAuthSecrets constructor
 
Method Summary
 void addEntry(String provider, String client, String server, String secret, String ipAddress)
          Add a new entry to the secrets file
 boolean checkForEntry(String provider, String client, String server, String secret, String ipAddress)
          Checks to see if an entry is already present
 String getSecret(String provider, String client, String server, String ipAddress)
          Return the secret as a string, given the other parameters.
 void removeEntry(int index)
          removed an entry based on an index
 void removeEntry(String type, String value)
          Removed an entry based on a 'type' where the type can be either provider, client, server, secret, or ipaddress.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PppAuthSecrets

public PppAuthSecrets(String secretsFilename)
PppAuthSecrets constructor

Parameters:
secretsFilename -
Method Detail

addEntry

public void addEntry(String provider,
                     String client,
                     String server,
                     String secret,
                     String ipAddress)
              throws Exception
Add a new entry to the secrets file

Parameters:
provider - cellular provider for which this secret applies
client - client/username for this secret
server - server ip for which this entry requires
secret - secret/password for this account
ipAddress - ipaddress for this account
Throws:
Exception

removeEntry

public void removeEntry(String type,
                        String value)
                 throws Exception
Removed an entry based on a 'type' where the type can be either provider, client, server, secret, or ipaddress. Note if the type occurs more than once, all entries of 'type' matching 'value' will be removed

Parameters:
type - can be either provider, client, server, secret, or ipaddress
value - is the value for the given type. For example, if the type is provider, then the value could be att
Throws:
Exception - for indexing problems

removeEntry

public void removeEntry(int index)
                 throws Exception
removed an entry based on an index

Parameters:
index - the index of the entry to be removed
Throws:
Exception - if the index is invalid

checkForEntry

public boolean checkForEntry(String provider,
                             String client,
                             String server,
                             String secret,
                             String ipAddress)
Checks to see if an entry is already present

Parameters:
provider - cellular provider for which this secret applies
client - client/username for this secret
server - server ip for which this entry requires
secret - secret/password for this account
ipAddress - ipaddress for this account
Returns:
boolean true - entry found false - entry not found

getSecret

public String getSecret(String provider,
                        String client,
                        String server,
                        String ipAddress)
Return the secret as a string, given the other parameters. Return null if not found.

Parameters:
provider - cellular provider for which this secret applies
client - client/username for this secret
server - server ip for which this entry requires
ipAddress - ipaddress for this account
Returns:
String


Copyright © 2013. All Rights Reserved.