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:
@@ -1,7 +1,7 @@
|
||||
note
|
||||
description: "[
|
||||
API to manage CMS User OAuth authentication.
|
||||
]"
|
||||
API to manage CMS User OAuth authentication.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -20,19 +20,36 @@ feature {NONE} -- Initialization
|
||||
|
||||
make_with_storage (a_api: CMS_API; a_oauth_storage: CMS_OAUTH_20_STORAGE_I)
|
||||
-- Create an object with api `a_api' and storage `a_oauth_storage'.
|
||||
local
|
||||
s: detachable READABLE_STRING_8
|
||||
do
|
||||
oauth_20_storage := a_oauth_storage
|
||||
make (a_api)
|
||||
|
||||
-- Initialize session related settings.
|
||||
s := a_api.setup.string_8_item ("auth.oauth.token")
|
||||
if s = Void then
|
||||
s := a_api.setup.site_id + default_session_token_suffix
|
||||
end
|
||||
create session_token.make_from_string (s)
|
||||
ensure
|
||||
oauht_20_storage_set: oauth_20_storage = a_oauth_storage
|
||||
oauth_20_storage_set: oauth_20_storage = a_oauth_storage
|
||||
end
|
||||
|
||||
feature {CMS_MODULE} -- Access: User oauth storage.
|
||||
feature {CMS_MODULE} -- Access: Oauth storage.
|
||||
|
||||
oauth_20_storage: CMS_OAUTH_20_STORAGE_I
|
||||
-- storage interface.
|
||||
|
||||
feature -- Access: User Oauth20
|
||||
feature -- Access: tokens
|
||||
|
||||
default_session_token_suffix: STRING = "_OAUTH_TOKEN_"
|
||||
-- Default value for `session_auth_token'.
|
||||
|
||||
session_token: IMMUTABLE_STRING_8
|
||||
-- Name of Cookie used to keep the session info.
|
||||
|
||||
feature -- Access: Oauth20
|
||||
|
||||
user_oauth2_by_id (a_uid: like {CMS_USER}.id; a_consumer: READABLE_STRING_GENERAL): detachable CMS_USER
|
||||
-- Retrieve a user by id `a_uid' for the consumer `a_consumer', if any.
|
||||
|
||||
Reference in New Issue
Block a user