To use this class, construct an object using the name of your program and an AUTH_KEY macro like this:
W2Authorization myAuth( "myprog", myprog_AUTH_KEY );
After constructing the object, call methods to get boolean and string attributes use those to control/configure your algorithm.
Public Member Functions | |
| W2Authorization (const std::string &keyName, int key1, int key2, int key3, int key4) throw ( Exception ) | |
| Note that you will not really pass 5 parameters to the constructor. | |
| bool | getBoolean (const std::string &optionName) |
| getting the boolean of a string option will always return false | |
| std::string | getString (const std::string &optionName) |
| if you try to get the string of an option that is boolean, you will get either "true" or "false" | |
| void | checkUserName () throw (Exception) |
| convenience function to check the user name is allowed | |
| void | checkDomainName () throw (Exception) |
| convenience function to check that the domain is authorized. | |
| code::TimeInterval | checkExpiryTime () throw (Exception) |
| convenience function to check that authorization time is not expired. | |
| void | checkExecutableName () throw (Exception) |
| convenience function to check that is a valid executable | |
| code::W2Authorization::W2Authorization | ( | const std::string & | keyName, | |
| int | key1, | |||
| int | key2, | |||
| int | key3, | |||
| int | key4 | |||
| ) | throw ( Exception ) |
Note that you will not really pass 5 parameters to the constructor.
You will instead use an AUTH_KEY macro:
W2Authorization myAuth( "myprog", myprog_AUTH_KEY );
throws an exception if the configuration file could not be found or could not be properly decoded.
| void code::W2Authorization::checkDomainName | ( | ) | throw (Exception) |
convenience function to check that the domain is authorized.
| void code::W2Authorization::checkExecutableName | ( | ) | throw (Exception) |
convenience function to check that is a valid executable
| code::TimeInterval code::W2Authorization::checkExpiryTime | ( | ) | throw (Exception) |
convenience function to check that authorization time is not expired.
This method throws an exception if the authorization has expired. Otherwise, it returns the TimeInterval left to expiration
| void code::W2Authorization::checkUserName | ( | ) | throw (Exception) |
convenience function to check the user name is allowed
| bool code::W2Authorization::getBoolean | ( | const std::string & | optionName | ) |
getting the boolean of a string option will always return false
| std::string code::W2Authorization::getString | ( | const std::string & | optionName | ) |
if you try to get the string of an option that is boolean, you will get either "true" or "false"
1.4.7