authorize-procs.tcl

Support for oauth authorization API

This file defines the following Objects and Classes: ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::Authorize[i], ::xo::oauth::GitHub[i], ::xo::oauth::GitHub[i], ::xo::Authorize[i]

Location:
packages/xooauth/tcl/authorize-procs.tcl
Author:
Gustaf Neumann

Procedures in this file

Detailed information

Class ::xo::Authorize (public)

 ::nx::Class ::xo::Authorize[i]

Base class to support OAuth authorization API

Testcases:
No testcase defined.

Class ::xo::oauth::GitHub (public)

 ::nx::Class ::xo::oauth::GitHub[i]

Tailored OAuth handler for GitHub

Testcases:
No testcase defined.

xo::Authorize method decoded_state (protected)

 <instance of xo::Authorize[i]> decoded_state state
Parameters:
state (required)

Testcases:
No testcase defined.

xo::Authorize method encoded_state (protected)

 <instance of xo::Authorize[i]> encoded_state \
    [ -return_url return_url ]
Switches:
-return_url (optional)

Testcases:
No testcase defined.

xo::Authorize method get_required_fields (protected)

 <instance of xo::Authorize[i]> get_required_fields -claims claims  \
    -mapped_fields mapped_fields 

Check, if required fields are provided in the claims and perform the name mapping between what was provided from the identity provided and what we need in OpenACS.

Switches:
-claims (required)
-mapped_fields (required)

Testcases:
No testcase defined.

xo::Authorize method login_url (public)

 <instance of xo::Authorize[i]> login_url [ -return_url return_url ] \
    [ -login login ]

Returns the URL for log-in

Switches:
-return_url (optional)
-login (optional)

Testcases:
No testcase defined.

xo::Authorize method logout (public)

 <instance of xo::Authorize[i]> logout

Perform logout operation from oauth in the background (i.e. without a redirect) when the logout_url is nonempty.

Testcases:
No testcase defined.

xo::Authorize method lookup_user_id (protected)

 <instance of xo::Authorize[i]> lookup_user_id [ -email email ]
Switches:
-email (optional)

Testcases:
No testcase defined.

xo::Authorize method name (public)

 <instance of xo::Authorize[i]> name
Returns:
instance name

Testcases:
No testcase defined.

xo::Authorize method perform_login (public)

 <instance of xo::Authorize[i]> perform_login [ -token token ] \
    [ -state state ]

Get the provided claims from the identity provider and perform an OpenACS login, when the user exists. In case the user does not exist, create it optionally (when "create_not_registered_users" is activated. When the user is created, and dotlrn is installed, the new user might be added optionally as a dotlrn user with the role as specified in "create_with_dotlrn_role".

Switches:
-token (optional)
-state (optional)

Testcases:
No testcase defined.

xo::Authorize method qualified (protected)

 <instance of xo::Authorize[i]> qualified partial_url
Parameters:
partial_url (required)

Testcases:
No testcase defined.

xo::Authorize method record_oauth_registration (protected)

 <instance of xo::Authorize[i]> record_oauth_registration user_id

Record the fact that this user_id was created via an OAuth identity provider.

Parameters:
user_id (required)

Testcases:
No testcase defined.

xo::Authorize method redeem_code (protected)

 <instance of xo::Authorize[i]> redeem_code code
Parameters:
code (required)

Testcases:
No testcase defined.

xo::Authorize method register_new_user (protected)

 <instance of xo::Authorize[i]> register_new_user \
    [ -first_names first_names ] [ -last_name last_name ] \
    [ -email email ]

Register the user and return the user_id. In case, the registration of the new user fails, raise an exception. not tested

Switches:
-first_names (optional)
-last_name (optional)
-email (optional)

Testcases:
No testcase defined.

xo::Authorize method required_fields (protected)

 <instance of xo::Authorize[i]> required_fields

Testcases:
No testcase defined.

xo::oauth::GitHub method get_api_data (protected)

 <instance of xo::oauth::GitHub[i]> get_api_data access_token
Parameters:
access_token (required)

Testcases:
No testcase defined.

xo::oauth::GitHub method get_user_data (public)

 <instance of xo::oauth::GitHub[i]> get_user_data [ -token token ] \
    [ -required_fields required_fields ]

Get user data based on the temporary code (passed via "-token") provided by GitHub. First, convert the temporary code into an access_token, and use this to get the user data.

Switches:
-token (optional)
-required_fields (optional, defaults to " {email email} {name name} ")

Testcases:
No testcase defined.

xo::oauth::GitHub method logout_url (public)

 <instance of xo::oauth::GitHub[i]> logout_url \
    [ -return_url return_url ]

Returns the URL for logging out. E.g., GitHub has no logout, so provide simply a redirect URL (maybe, we should logout from the application?)

Switches:
-return_url (optional)

Testcases:
No testcase defined.
[ show source ]