edu.ucsb.nceas.metacat

## Class AuthSession

- java.lang.Object
- - edu.ucsb.nceas.metacat.AuthSession

-     public class AuthSession
      extends java.lang.Object

  A Class that implements session tracking for MetaCatServlet users. User's login data are stored in the session object. User authentication is done through a dynamically determined AuthInterface.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AuthSession()` Construct an AuthSession
    `AuthSession(int groupCacheSize)` Constructor with cached group information for users.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `authenticate(javax.servlet.http.HttpServletRequest request, java.lang.String username, java.lang.String password)` determine if the credentials for this session are valid by authenticating them using the authService configured for this session.
    `java.util.HashMap<java.lang.String,java.util.Vector<java.lang.String>>` | `getAttributes(java.lang.String foruser)` Get attributes describing a user or group
    `java.lang.String[]` | `getGroups(java.lang.String logInUserName, java.lang.String logInUserPassword, java.lang.String userDN)` Get the all groups in which the given userDN is
    `java.lang.String` | `getMessage()` Get the message associated with authenticating this session.
    `java.lang.String` | `getPrincipals(java.lang.String user, java.lang.String password)` Get all groups and users from authentication scheme.
    `javax.servlet.http.HttpSession` | `getSessions()` Get the new session

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AuthSession

          public AuthSession()
                      throws java.lang.InstantiationException,
                             java.lang.IllegalAccessException,
                             java.lang.ClassNotFoundException

      Construct an AuthSession
      Throws:
        `java.lang.ClassNotFoundException`
        `java.lang.IllegalAccessException`
        `java.lang.InstantiationException`

    - #### AuthSession

          public AuthSession(int groupCacheSize)
                      throws java.lang.InstantiationException,
                             java.lang.IllegalAccessException,
                             java.lang.ClassNotFoundException

      Constructor with cached group information for users.
      Parameters:
        `groupCacheSize` - the size of the LRUMap map
      Throws:
        `java.lang.InstantiationException`
        `java.lang.IllegalAccessException`
        `java.lang.ClassNotFoundException`

  - ### Method Detail

    - #### getSessions

          public javax.servlet.http.HttpSession getSessions()

      Get the new session

    - #### authenticate

          public boolean authenticate(javax.servlet.http.HttpServletRequest request,
                                      java.lang.String username,
                                      java.lang.String password)

      determine if the credentials for this session are valid by authenticating them using the authService configured for this session.
      Parameters:
        `request` - the request made from the client
        `username` - the username entered when login
        `password` - the password entered when login

    - #### getMessage

          public java.lang.String getMessage()

      Get the message associated with authenticating this session. The message is formatted in XML.

    - #### getPrincipals

          public java.lang.String getPrincipals(java.lang.String user,
                                                java.lang.String password)
                                         throws java.net.ConnectException

      Get all groups and users from authentication scheme. The output is formatted in XML.
      Parameters:
        `user` - the user which requests the information
        `password` - the user's password
      Throws:
        `java.net.ConnectException`

    - #### getAttributes

          public java.util.HashMap<java.lang.String,java.util.Vector<java.lang.String>> getAttributes(java.lang.String foruser)
                                                                                               throws java.net.ConnectException

      Get attributes describing a user or group
      Parameters:
        `foruser` - the user for which the attribute list is requested
      Throws:
        `java.net.ConnectException`

    - #### getGroups

          public java.lang.String[] getGroups(java.lang.String logInUserName,
                                              java.lang.String logInUserPassword,
                                              java.lang.String userDN)
                                       throws java.lang.Exception

      Get the all groups in which the given userDN is
      Parameters:
        `logInUserName` - it can be null
        `logInUserPassword` - it can be null
        `userDN` -
      Returns:
        null if no groups were found for the userDN
      Throws:
        `java.lang.Exception`

Copyright © 2023 Regents of the University of California. All Rights Reserved.