Options for the Mascot security system. More...
#include <ms_security_options.hpp>
Public Member Functions | |
ms_security_options () | |
Loads the options file into memory. | |
ms_security_options (const ms_security_options &src) | |
void | appendErrors (const ms_errors &src) |
Copies all errors from another instance and appends them at the end of own list. | |
void | clearAllErrors () |
Remove all errors from the current list of errors. | |
void | copyFrom (const ms_errors *right) |
Use this member to make a copy of another instance. | |
void | copyFrom (const ms_security_options *right) |
time_t | getDefaultPasswordExpiryTime () const |
Returns the time in days before a password expires. | |
const ms_errs * | getErrorHandler () const |
Retrive the error object using this function to get access to all errors and error parameters. | |
std::string | getIntegraAppServerURL () const |
Returns the URL to the Integra Application server host. | |
std::string | getIntegraDatabaseName () const |
Returns the name of the Integra database. | |
std::string | getIntegraOracleServerName () const |
Returns the name of the oracle server for Mascot Integra. | |
int | getLastError () const |
Return the error description of the last error that occurred. | |
std::string | getLastErrorString () const |
Return the error description of the last error that occurred. | |
std::string | getLogFileName () |
Returns the log file name. | |
matrix_science::ms_errs::msg_sev | getLoggingLevel () const |
Returns the logging level. | |
unsigned int | getMinimumPasswordLength () const |
Returns the minimum password length. | |
time_t | getSessionTimeout () const |
Returns the time in seconds before a user is logged out. | |
bool | getUseSessionCookies () const |
Returns true if session (rather than file) cookies are to be used. | |
bool | getVerifySessionIPAddress () const |
Returns true if a session will be invalid if used from a different IP address from the original session request. | |
bool | isSecurityEnabled () const |
Will return true if the Mascot security system is enabled. | |
bool | isValid () const |
Call this function to determine if there have been any errors. | |
ms_security_options & | operator= (const ms_security_options &right) |
void | setDefaultPasswordExpiryTime (time_t newVal) |
Sets the time in days before a password expires. | |
void | setIntegraAppServerURL (std::string newVal) |
Sets the URL to the Integra Application server host. | |
void | setIntegraDatabaseName (std::string newVal) |
Sets the name of the Integra database. | |
void | setIntegraOracleServerName (std::string newVal) |
Sets the name of the oracle server for Mascot Integra. | |
void | setLogFileName (std::string newVal) |
Sets the log file name. | |
void | setLoggingLevel (ms_errs::msg_sev newVal) |
Sets the logging level. | |
void | setMinimumPasswordLength (unsigned int newVal) |
Sets the minimum password length. | |
void | setSecurityEnabled (bool newVal) |
Enables the Mascot security system. | |
void | setSessionTimeout (time_t newVal) |
Sets the time in seconds before a user is logged out. | |
void | setUseSessionCookies (bool newVal) |
Set whether session or file cookies should be used. | |
void | setVerifySessionIPAddress (bool newVal) |
Set if a session will be invalid if used from a different IP address from the original session request. | |
Options for the Mascot security system.
This class will generally only be used by the security administration utility. It is used by the ms_security and ms_session classes.
Loads the options file into memory.
If the file cannot be found, the following defaults are set:
It will often be faster to call ms_security::getMascotSecurityOptions() if a ms_security object is already available.
ms_security_options | ( | const ms_security_options & | src | ) |
src | is the source to initialise from |
|
inherited |
Copies all errors from another instance and appends them at the end of own list.
src | The object to copy the errors across from. See Maintaining object references: two rules of thumb. |
|
inherited |
Remove all errors from the current list of errors.
The list of 'errors' can include fatal errors, warning messages, information messages and different levels of debugging messages.
All messages are accumulated into a list in this object, until clearAllErrors() is called.
See Error Handling.
|
inherited |
Use this member to make a copy of another instance.
right | is the source to initialise from |
void copyFrom | ( | const ms_security_options * | right | ) |
right | is the source to initialise from |
time_t getDefaultPasswordExpiryTime | ( | ) | const |
Returns the time in days before a password expires.
When a new user is created using ms_security::addNewUser(), the password expiry is explicity set using that function. A value of 1 will typically be passed to that function to force the user to choose a new password when they first log in. However, the administration utility could take the current time, and add this default value to set the new expiry time.
This default value is used to set the expiry time for the password when ms_security::updatePassword() is called. If the default expiry time is zero, then the user's password will be set to never expire.
|
inherited |
Retrive the error object using this function to get access to all errors and error parameters.
See Error Handling.
std::string getIntegraAppServerURL | ( | ) | const |
Returns the URL to the Integra Application server host.
Mascot Integra users should be able to use the same login for the Mascot search engine and Mascot Integra. This is the URL to the Mascot Integra system. Should be blank where there is no local Mascot Integra installation. It will typically be of the form http://integra:8080/topaz
.
std::string getIntegraDatabaseName | ( | ) | const |
Returns the name of the Integra database.
Mascot Integra users should be able to use the same login for the Mascot search engine and Mascot Integra. This is the database name on the Mascot Integra system. Should be blank where there is no local Mascot Integra installation. It will typically be 'integra'.
std::string getIntegraOracleServerName | ( | ) | const |
Returns the name of the oracle server for Mascot Integra.
Mascot Integra users should be able to use the same login for the Mascot search engine and Mascot Integra. This is the location of the Oracle server used by Mascot Integra, which may not be on the same system as Mascot Integra. Should be blank where there is no local Mascot Integra installation. It will typically be 'integra'.
|
inherited |
Return the error description of the last error that occurred.
All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.
See Error Handling.
|
inherited |
Return the error description of the last error that occurred.
All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.
See Error Handling.
std::string getLogFileName | ( | ) |
Returns the log file name.
Any changes to security settings are logged in the log file.
ms_errs::msg_sev getLoggingLevel | ( | ) | const |
Returns the logging level.
Any changes to security settings are logged in the log file. The number of messages depends on the logging level.
unsigned int getMinimumPasswordLength | ( | ) | const |
Returns the minimum password length.
A value of zero can be used to indicate that passwords are not required. This value is checked when ms_security::addNewUser() or ms_security::updatePassword() are called. If the entered password is less than this length, then the error ms_errs::ERR_MSP_SECURITY_PASSWORD_TOO_SHORT will be generated.
time_t getSessionTimeout | ( | ) | const |
Returns the time in seconds before a user is logged out.
Accessing a session using ms_session (normally done viewing any page that uses the session) will start the clock ticking again for that session. Session timeouts are not used for guest sessions, or if the user type is one of
bool getUseSessionCookies | ( | ) | const |
Returns true if session (rather than file) cookies are to be used.
A session, or non persistent cookie is not saved on the end users disk, and just lasts for the time that the browser is open. A file or persistent cookie is saved on the end users disk so that it will be available when the browser is opened again.
The name of the cookie that saves the session ID should be MascotSessionID
– see ms_session::ms_session() for details of how the cookie is used.
The only time that a cookie should be set is when the user logs in. If this option to use session cookies is set, then the 'expires' value must not be set. See also setUseSessionCookies().
bool getVerifySessionIPAddress | ( | ) | const |
Returns true if a session will be invalid if used from a different IP address from the original session request.
When a session is created, the IP address of the originator and the value of this flag is saved in the session file. If this flag is set to true, and there is a request to open the session from a different IP address, then that request will be denied with the error ms_errs::ERR_MSP_SECURITY_DIFFERENTIPADDR. Guest users, or any user with the type ms_user::USER_WEBAUTH will never generate that error.
bool isSecurityEnabled | ( | ) | const |
Will return true if the Mascot security system is enabled.
Most applications will not need to call this function, since they will need to create a ms_session object anyway, and can then use the ms_session::isSecurityEnabled() function.
|
inherited |
Call this function to determine if there have been any errors.
This will return true unless there have been any fatal errors.
See Error Handling.
ms_security_options & operator= | ( | const ms_security_options & | right | ) |
right | is the source to initialise from |
void setDefaultPasswordExpiryTime | ( | time_t | newVal | ) |
Sets the time in days before a password expires.
When a new user is created using ms_security::addNewUser(), the password expiry is explicity set using that function. A value of 1 will typically be passed to that function to force the user to choose a new password when they first log in. However, the administration utility could take the current time, and add this default value to set the new expiry time.
This default value is used to set the expiry time for the password when ms_security::updatePassword is called. If the default expiry time is zero, then the user's password will be set to never expire.
newVal | is the new expiry time in days. |
void setIntegraAppServerURL | ( | std::string | newVal | ) |
Sets the URL to the Integra Application server host.
Mascot Integra users should be able to use the same login for the Mascot search engine and Mascot Integra. This is the URL to the Mascot Integra system. Should be blank where there is no local Mascot Integra installation. It will typically be of the form http://integra:8080/topaz
.
newVal | The URL for Mascot Integra server. |
void setIntegraDatabaseName | ( | std::string | newVal | ) |
Sets the name of the Integra database.
Mascot Integra users should be able to use the same login for the Mascot search engine and Mascot Integra. This is the database name on the Mascot Integra system. Should be blank where there is no local Mascot Integra installation. It will typically be 'integra'.
newVal | The Mascot Integra database name. |
void setIntegraOracleServerName | ( | std::string | newVal | ) |
Sets the name of the oracle server for Mascot Integra.
Mascot Integra users should be able to use the same login for the Mascot search engine and Mascot Integra. This is the location of the Oracle server used by Mascot Integra, which may not be on the same system as Mascot Integra. Should be blank where there is no local Mascot Integra installation. It will typically be 'integra'.
newVal | The Mascot Integra Oracle database server name. |
void setLogFileName | ( | std::string | newVal | ) |
Sets the log file name.
Any changes to security settings are logged in the log file.
newVal | The new log file name. |
void setLoggingLevel | ( | ms_errs::msg_sev | newVal | ) |
Sets the logging level.
Any changes to security settings are logged in the log file. (../logs/security.log
). The number of messages depends on the logging level:
newVal | The new logging level. |
void setMinimumPasswordLength | ( | unsigned int | newVal | ) |
Sets the minimum password length.
A value of zero can be used to indicate that passwords are not required. This value is checked when ms_security::addNewUser() or ms_security::updatePassword() are called. If the entered password is less than this length, then the error ms_errs::ERR_MSP_SECURITY_PASSWORD_TOO_SHORT will be generated.
newVal | is the new minimum password length. |
void setSecurityEnabled | ( | bool | newVal | ) |
Enables the Mascot security system.
Used by the security administration utility. See also isSecurityEnabled().
newVal | Should be set to true to enable security or false to disable it. |
void setSessionTimeout | ( | time_t | newVal | ) |
Sets the time in seconds before a user is logged out.
Viewing any page that uses the session timeout will start the clock ticking again. Session timeouts are not used for guest sessions, or if the user type is one of
newVal | is the new session timeout in seconds. It must be in the range 60 to 31,449,600 (one year). |
void setUseSessionCookies | ( | bool | newVal | ) |
Set whether session or file cookies should be used.
A session, or non persistent cookie is not saved on the end users disk, and just lasts for the time that the browser is open. A file or persistent cookie is saved on the end users disk so that it will be available when the browser is opened again.
The name of the cookie that saves the session ID should be MascotSessionID
– see ms_session::ms_session() for details of how the cookie is used.
The only time that a cookie should be set is when the user logs in. If this option to use session cookies is set, then the 'expires' value must not be set. See also getUseSessionCookies().
newVal | Should be set to true to specify that session rather than persistent cookies should be used. |
void setVerifySessionIPAddress | ( | bool | newVal | ) |
Set if a session will be invalid if used from a different IP address from the original session request.
When a session is created, the IP address of the originator and the value of this flag is saved in the session file. If this flag is set to true, and there is a request to open the session from a different IP address, then that request will be denied with the error ms_errs::ERR_MSP_SECURITY_DIFFERENTIPADDR. Guest users, or any user with the type ms_user::USER_WEBAUTH will never generate that error.
newVal | Should be set to true if IP addresses should be checked. |