/** @brief Initialize the application by registering functions for method calls. @return Zero on success, 1 on error. */ int osrfAppInitialize() { osrfLogInfo(OSRF_LOG_MARK, "Initializing Auth Internal Server..."); /* load and parse the IDL */ /* return non-zero to indicate error */ if (!oilsInitIDL(NULL)) return 1; osrfAppRegisterMethod( MODULENAME, "open-ils.auth_internal.session.create", "oilsAuthInternalCreateSession", "Adds a user to the authentication cache to indicate " "the user is authenticated", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth_internal.user.validate", "oilsAuthInternalValidate", "Determines whether a user should be allowed to login. " "Returns SUCCESS oilsEvent when the user is valid, otherwise " "returns a non-SUCCESS oilsEvent object", 1, 0 ); return 0; }
/** @brief Initialize the application by registering functions for method calls. @return Zero in all cases. */ int osrfAppInitialize() { osrfLogInfo(OSRF_LOG_MARK, "Initializing Auth Server..."); /* load and parse the IDL */ if (!oilsInitIDL(NULL)) return 1; /* return non-zero to indicate error */ osrfAppRegisterMethod( MODULENAME, "open-ils.auth.authenticate.init", "oilsAuthInit", "Start the authentication process and returns the intermediate authentication seed" " PARAMS( username )", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.authenticate.complete", "oilsAuthComplete", "Completes the authentication process. Returns an object like so: " "{authtoken : <token>, authtime:<time>}, where authtoken is the login " "token and authtime is the number of seconds the session will be active" "PARAMS(username, md5sum( seed + md5sum( password ) ), type, org_id ) " "type can be one of 'opac','staff', or 'temp' and it defaults to 'staff' " "org_id is the location at which the login should be considered " "active for login timeout purposes", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.session.retrieve", "oilsAuthSessionRetrieve", "Pass in the auth token and this retrieves the user object. The auth " "timeout is reset when this call is made " "Returns the user object (password blanked) for the given login session " "PARAMS( authToken )", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.session.delete", "oilsAuthSessionDelete", "Destroys the given login session " "PARAMS( authToken )", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.session.reset_timeout", "oilsAuthResetTimeout", "Resets the login timeout for the given session " "Returns an ILS Event with payload = session_timeout of session " "if found, otherwise returns the NO_SESSION event" "PARAMS( authToken )", 1, 0 ); return 0; }
/** @brief Initialize the application by registering functions for method calls. @return Zero in all cases. */ int osrfAppInitialize() { osrfLogInfo(OSRF_LOG_MARK, "Initializing Auth Server..."); /* load and parse the IDL */ if (!oilsInitIDL(NULL)) return 1; /* return non-zero to indicate error */ osrfAppRegisterMethod( MODULENAME, "open-ils.auth.authenticate.init", "oilsAuthInit", "Start the authentication process and returns the intermediate authentication seed" " PARAMS( username )", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.authenticate.init.barcode", "oilsAuthInitBarcode", "Start the authentication process using a patron barcode and return " "the intermediate authentication seed. PARAMS(barcode)", 1, 0); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.authenticate.init.username", "oilsAuthInitUsername", "Start the authentication process using a patron username and return " "the intermediate authentication seed. PARAMS(username)", 1, 0); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.authenticate.complete", "oilsAuthComplete", "Completes the authentication process. Returns an object like so: " "{authtoken : <token>, authtime:<time>}, where authtoken is the login " "token and authtime is the number of seconds the session will be active" "PARAMS(username, md5sum( seed + md5sum( password ) ), type, org_id ) " "type can be one of 'opac','staff', or 'temp' and it defaults to 'staff' " "org_id is the location at which the login should be considered " "active for login timeout purposes", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.login", "oilsAuthLogin", "Request an authentication token logging in with username or " "barcode. Parameter is a keyword arguments hash with keys " "username, barcode, identifier, password, type, org, workstation, " "agent. The 'identifier' option is used when the caller wants the " "API to determine if an identifier string is a username or barcode " "using the barcode format configuration.", 1, 0); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.authenticate.verify", "oilsAuthComplete", "Verifies the user provided a valid username and password." "Params and are the same as open-ils.auth.authenticate.complete." "Returns SUCCESS event on success, failure event on failure", 1, 0); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.session.retrieve", "oilsAuthSessionRetrieve", "Pass in the auth token and this retrieves the user object. By " "default, the auth timeout is reset when this call is made. If " "a second non-zero parameter is passed, the auth timeout info is " "returned to the caller along with the user object. If a 3rd " "non-zero parameter is passed, the auth timeout will not be reset." "Returns the user object (password blanked) for the given login session " "PARAMS( authToken[, returnTime[, doNotResetSession]] )", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.session.delete", "oilsAuthSessionDelete", "Destroys the given login session " "PARAMS( authToken )", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.session.reset_timeout", "oilsAuthResetTimeout", "Resets the login timeout for the given session " "Returns an ILS Event with payload = session_timeout of session " "if found, otherwise returns the NO_SESSION event" "PARAMS( authToken )", 1, 0 ); if(!_oilsAuthSeedTimeout) { /* Load the default timeouts */ jsonObject* value_obj; value_obj = osrf_settings_host_value_object( "/apps/open-ils.auth/app_settings/auth_limits/seed" ); _oilsAuthSeedTimeout = oilsUtilsIntervalToSeconds( jsonObjectGetString( value_obj )); jsonObjectFree(value_obj); if( -1 == _oilsAuthSeedTimeout ) { osrfLogWarning( OSRF_LOG_MARK, "Invalid timeout for Auth Seeds - Using 30 seconds" ); _oilsAuthSeedTimeout = 30; } value_obj = osrf_settings_host_value_object( "/apps/open-ils.auth/app_settings/auth_limits/block_time" ); _oilsAuthBlockTimeout = oilsUtilsIntervalToSeconds( jsonObjectGetString( value_obj )); jsonObjectFree(value_obj); if( -1 == _oilsAuthBlockTimeout ) { osrfLogWarning( OSRF_LOG_MARK, "Invalid timeout for Blocking Timeout - Using 3x Seed" ); _oilsAuthBlockTimeout = _oilsAuthSeedTimeout * 3; } value_obj = osrf_settings_host_value_object( "/apps/open-ils.auth/app_settings/auth_limits/block_count" ); _oilsAuthBlockCount = oilsUtilsIntervalToSeconds( jsonObjectGetString( value_obj )); jsonObjectFree(value_obj); if( -1 == _oilsAuthBlockCount ) { osrfLogWarning( OSRF_LOG_MARK, "Invalid count for Blocking - Using 10" ); _oilsAuthBlockCount = 10; } osrfLogInfo(OSRF_LOG_MARK, "Set auth limits: " "seed => %ld : block_timeout => %ld : block_count => %ld", _oilsAuthSeedTimeout, _oilsAuthBlockTimeout, _oilsAuthBlockCount ); } return 0; }
/** @brief Initialize the application by registering functions for method calls. @return Zero in all cases. */ int osrfAppInitialize() { osrfLogInfo(OSRF_LOG_MARK, "Initializing Auth Server..."); /* load and parse the IDL */ if (!oilsInitIDL(NULL)) return 1; /* return non-zero to indicate error */ osrfAppRegisterMethod( MODULENAME, "open-ils.auth.authenticate.init", "oilsAuthInit", "Start the authentication process and returns the intermediate authentication seed" " PARAMS( username )", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.authenticate.complete", "oilsAuthComplete", "Completes the authentication process. Returns an object like so: " "{authtoken : <token>, authtime:<time>}, where authtoken is the login " "token and authtime is the number of seconds the session will be active" "PARAMS(username, md5sum( seed + md5sum( password ) ), type, org_id ) " "type can be one of 'opac','staff', or 'temp' and it defaults to 'staff' " "org_id is the location at which the login should be considered " "active for login timeout purposes", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.authenticate.verify", "oilsAuthComplete", "Verifies the user provided a valid username and password." "Params and are the same as open-ils.auth.authenticate.complete." "Returns SUCCESS event on success, failure event on failure", 1, 0); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.session.retrieve", "oilsAuthSessionRetrieve", "Pass in the auth token and this retrieves the user object. The auth " "timeout is reset when this call is made " "Returns the user object (password blanked) for the given login session " "PARAMS( authToken )", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.session.delete", "oilsAuthSessionDelete", "Destroys the given login session " "PARAMS( authToken )", 1, 0 ); osrfAppRegisterMethod( MODULENAME, "open-ils.auth.session.reset_timeout", "oilsAuthResetTimeout", "Resets the login timeout for the given session " "Returns an ILS Event with payload = session_timeout of session " "if found, otherwise returns the NO_SESSION event" "PARAMS( authToken )", 1, 0 ); if(!_oilsAuthSeedTimeout) { /* Load the default timeouts */ jsonObject* value_obj; value_obj = osrf_settings_host_value_object( "/apps/open-ils.auth/app_settings/auth_limits/seed" ); _oilsAuthSeedTimeout = oilsUtilsIntervalToSeconds( jsonObjectGetString( value_obj )); jsonObjectFree(value_obj); if( -1 == _oilsAuthSeedTimeout ) { osrfLogWarning( OSRF_LOG_MARK, "Invalid timeout for Auth Seeds - Using 30 seconds" ); _oilsAuthSeedTimeout = 30; } value_obj = osrf_settings_host_value_object( "/apps/open-ils.auth/app_settings/auth_limits/block_time" ); _oilsAuthBlockTimeout = oilsUtilsIntervalToSeconds( jsonObjectGetString( value_obj )); jsonObjectFree(value_obj); if( -1 == _oilsAuthBlockTimeout ) { osrfLogWarning( OSRF_LOG_MARK, "Invalid timeout for Blocking Timeout - Using 3x Seed" ); _oilsAuthBlockTimeout = _oilsAuthSeedTimeout * 3; } value_obj = osrf_settings_host_value_object( "/apps/open-ils.auth/app_settings/auth_limits/block_count" ); _oilsAuthBlockCount = oilsUtilsIntervalToSeconds( jsonObjectGetString( value_obj )); jsonObjectFree(value_obj); if( -1 == _oilsAuthBlockCount ) { osrfLogWarning( OSRF_LOG_MARK, "Invalid count for Blocking - Using 10" ); _oilsAuthBlockCount = 10; } osrfLogInfo(OSRF_LOG_MARK, "Set auth limits: " "seed => %ld : block_timeout => %ld : block_count => %ld", _oilsAuthSeedTimeout, _oilsAuthBlockTimeout, _oilsAuthBlockCount ); } return 0; }