NAME

OME::SessionManager - Get an OME::Session object.

Back to Top


SYNOPSIS

        use OME::SessionManager;
        use OME::Session;
        my $manager = OME::SessionManager->new();
        my $session = $manager->createSession($username,$password);
        my $sessionKey = $session->SessionKey();
        $manager->logout($session);
        my $session = $manager->createSession($sessionKey);
        $manager->logout($session);
        my $session = OME::SessionManager->TTYlogin();
        $manager->logout($session);

Back to Top


DESCRIPTION

This class is used to get an initial OME::Session object. There are several authentication methods implemented including username/password, a string token (SessionKey) and a TTY login from the command line. The SessionKey token is used for short-term persistance between a client and the OME server.

Back to Top


METHODS

createSession

        $manager->createSession ($username,$password);
        $manager->createSession ($sessionKey);

This method will attempt a connection to the DB using $username/$password or $sessionKey, and return an OME::Session object if successful. A set of flags can be optionally passed in the last parameter as a hash reference. Supported flags include DataSource, DBUser and DBPassword: $manager->createSession ($sessionKey, {DataSource => 'foo', DBUser => 'bar'});

TTYlogin

        $manager->TTYlogin ();

This method will attempt to get login information from the user using a terminal interface. If successfull, it will cache the SessionKey in the user's ~/.omelogin file.

    If flags, user name, and password are provided (in order), they
    will be used as appropriate.
    $session = $self->promptAndLogin($loginFile,$session);
    ask for a session via prompts and try to create it

getRSAmodulus

        my $challenge = $manager->getRSAmodulus();

Generates a private key in $TEMP/$KEY_FILE, and returns its modulus as a hex string. The public exponent is hard-coded to be -F4 (0x10001). The modulus is as a public key used by the JavaScript RSA library (or other RSA implementations) to encrypt passwords (or other data).

createWithRSAPassword

        my $session = $manager->createWithRSAPassword($username,$password,$flags);

Decrypts the password using the RSA key stored in $TEMP/$KEY_FILE, then calls CreateWithPassword to make the session. The plaintext password follows a time signature (result of time() call) in brackets. For example: [1185410367]abc123 corresponds to 2007-07-26 00:39:27Z, and the plaintext password abc123 This plaintext string is encrypted and then base-64 encoded.

makeOrGetUserState

        $manager->makeOrGetUserState ( $factory, experimenter_id => $my_exp_id );
        $manager->makeOrGetUserState ( $factory, experimenter => $my_experimenter_object );
        $manager->makeOrGetUserState ( $factory, OMEName => $my_experimenter_username );
        $manager->makeOrGetUserState ( $factory, session_key => $my_key );
        # Note that passing session_key will return undef unless the key exists.
        # In all other cases, the userstate will be created if it doesn't exist.

logout

        $manager->logout ($session);

Unregisters the $session from this $manager.

logout

        $manager->authenticate_LDAP ($ldap_conf,$username,$password);
        OME::SessionManager->authenticate_LDAP ($ldap_conf,$username,$password);

Attempts ldap authentication wether or not $ldap_conf->{use} flag is set. returns 1 if ldap authentication is successful. returns 0 if authentication failed. returns undef on error (failed server connection, etc).

Back to Top