Credential.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /**
  2. * Licensed Materials - Property of IBM
  3. *
  4. * IBM Cognos Products: CAMAAA
  5. *
  6. * (C) Copyright IBM Corp. 2005, 2012
  7. *
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with
  9. * IBM Corp.
  10. */
  11. import java.util.HashMap;
  12. import java.util.Set;
  13. import java.util.Vector;
  14. import com.cognos.CAM_AAA.authentication.ICredential;
  15. @SuppressWarnings("rawtypes")
  16. public class Credential implements ICredential
  17. {
  18. /**
  19. *
  20. */
  21. public Credential()
  22. {
  23. super();
  24. credentials = null;
  25. }
  26. /*
  27. * (non-Javadoc)
  28. *
  29. * @see com.cognos.CAM_AAA.authentication.ICredential#getCredentialNames()
  30. */
  31. public String[] getCredentialNames()
  32. {
  33. if (credentials != null)
  34. {
  35. Set keySet = credentials.keySet();
  36. String[] array = new String[keySet.size()];
  37. return (String[]) keySet.toArray(array);
  38. }
  39. return null;
  40. }
  41. /**
  42. * @param theName
  43. * @param theValue
  44. */
  45. public void addCredentialValue(String theName, String theValue)
  46. {
  47. if (credentials == null)
  48. {
  49. credentials = new HashMap();
  50. }
  51. Vector v = (Vector) this.credentials.get(theName);
  52. if (v == null)
  53. {
  54. v = new Vector();
  55. this.credentials.put(theName, v);
  56. }
  57. v.add(theValue);
  58. }
  59. /*
  60. * (non-Javadoc)
  61. *
  62. * @see com.cognos.CAM_AAA.authentication.ICredential#getCredentialValue(java.lang.String)
  63. */
  64. public String[] getCredentialValue(String theName)
  65. {
  66. if (credentials != null)
  67. {
  68. Vector v = (Vector) this.credentials.get(theName);
  69. if (v != null)
  70. {
  71. return (String[]) v.toArray(new String[v.size()]);
  72. }
  73. }
  74. return null;
  75. }
  76. private HashMap credentials;
  77. }