Fixed various CMS_MODULE.install, by not marked module installed if an error occurred!
Improved Auth related module implementation by having a way to change settings like token, max age. - use CMS_SETUP.site_id and related "auth.$module.token" ... configuration values. - removed related CMS_..._CONSTANTS classes. For auth session module, use auth_session as table name, and use VARCHAR(64). Extracted sql from blog module, and store it under site/scripts/install.sql . Renamed a few $modulename.sql as install.sql
This commit is contained in:
@@ -7,6 +7,7 @@ note
|
||||
|
||||
class
|
||||
CMS_OPENID_API
|
||||
|
||||
inherit
|
||||
CMS_MODULE_API
|
||||
|
||||
@@ -19,9 +20,25 @@ feature {NONE} -- Initialization
|
||||
|
||||
make_with_storage (a_api: CMS_API; a_openid_storage: CMS_OPENID_STORAGE_I)
|
||||
-- Create an object with api `a_api' and storage `a_openid_storage'.
|
||||
local
|
||||
s: detachable READABLE_STRING_8
|
||||
do
|
||||
openid_storage := a_openid_storage
|
||||
make (a_api)
|
||||
|
||||
-- Initialize openid related settings.
|
||||
s := a_api.setup.string_8_item ("auth.openid.token")
|
||||
if s = Void then
|
||||
s := a_api.setup.site_id + default_session_token_suffix
|
||||
end
|
||||
create session_token.make_from_string (s)
|
||||
|
||||
s := a_api.setup.string_8_item ("auth.openid.max_age")
|
||||
if s /= Void and then s.is_integer then
|
||||
session_max_age := s.to_integer
|
||||
else
|
||||
session_max_age := 3600 --| one hour: *60(min) *60(sec)
|
||||
end
|
||||
ensure
|
||||
openid_storage_set: openid_storage = a_openid_storage
|
||||
end
|
||||
@@ -31,6 +48,16 @@ feature {CMS_MODULE} -- Access: User openid storage.
|
||||
openid_storage: CMS_OPENID_STORAGE_I
|
||||
-- storage interface.
|
||||
|
||||
feature -- Access: token
|
||||
|
||||
default_session_token_suffix: STRING = "_OPENID_TOKEN_"
|
||||
|
||||
session_token: IMMUTABLE_STRING_8
|
||||
-- Name of Cookie used to keep the session info.
|
||||
|
||||
session_max_age: INTEGER
|
||||
-- Max age.
|
||||
|
||||
feature -- Access: User Openid
|
||||
|
||||
user_openid_by_userid_identity (a_uid: like {CMS_USER}.id; a_identity: READABLE_STRING_GENERAL): detachable CMS_USER
|
||||
|
||||
Reference in New Issue
Block a user