UserCredentials

Description

In BBj 11.0 and higher, use the UserCredentials class in conjunction with the Admin class in the Admin Utility to access user credential information.

Creation

The UserCredentials class is found in <bbj install>/utils/admin.bbj.

Obtain a UserCredentials object from the Admin utility:
userCredentials! = admin!.getUserCredentials()

To create a UserCredentials object, use the following constructor:
userCredentials! = new UserCredentials(string host, int port, boolean ssl, int timeout, string user, int requiredPermissions)

Parameters

Parameter

Description

host

Specifies the host name of the BBjServices

password

The user's password

port

Specifies the port of the BBjServices Admin server

requiredPermissions

The required permission of the user

ssl

Specify true (1) if using SSL to connect to BBjServices; otherwise specify false (0)

timeout

Specifies the timeout of milliseconds

user

The name of the user

Methods of UserCredentials

Return Value

Method

string

getHost()

string

getPassword()

int

getPort()

int

getRequiredPermissions()

boolean

getSSL()

int

getTimeout()

string

getUser()

void

setHost(string host)

void

setPassword(string password)

void

setPort(int port)

void

setRequiredPermissions(int permissions)

void

setSSL(boolean ssl)

void

setTimeout(int timeout)

void

setUser(string user)

Remarks

None.

Constants

None.

Example

rem Admin Utility Demo

 rem Use Statements
 use ::admin.bbj::Admin
 use ::admin.bbj::UserCredentials

 rem Declares
 declare Admin admin!
 declare UserCredentials userCredentials!

 rem Authenticate the user jsmith
 admin! = new Admin()
 admin!.setUser("jsmith")
 userCredentials! = admin!.getUserCredentials()
 if (userCredentials! <> null())
    print "User: " + userCredentials!.getUser()
    print "Password: " + userCredentials!.getPassword()
    print "Host: " + userCredentials!.getHost()
    print "Port: " + str(userCredentials!.getPort())
    print "SSL: " + str(userCredentials!.getSSL())
    print "Timeout: " + str(userCredentials!.getTimeout())
    end
 else
    print "Could not authenticate user"
 endif
 end 

See Also

BBj Object Syntax

Admin

Admin API