Is there any function to do login action in CKAN without API call

Question:

Ideally how login works in CKAN as per who.ini configuration and code is:

[plugin:friendlyform]
use = ckan.lib.repoze_plugins.friendly_form:FriendlyFormPlugin
login_form_url= /user/login
login_handler_path = /login_generic

Here login_handler_path is responsible for login and in frontend side of CKAN, it makes POST request to /login_generic endpoint with name as username and password.

Right now I am trying to create one plugin, where I am trying to login via plugin itself (with some function) without having user to login via any form in frontend.

So is there any helper / action function which I can use so that I can login behind the scenes in CKAN plugin itself.

What I understand is that CKAN uses some repoze cookie / API Headers to identify if user is logged in or not. If I make use of normal POST requests in python code, then I won’t be able to set these cookies or environment variables and if I try to do it manually then I fear it will break something.

Any help is much appreciated

Asked By: Shashank

||

Answers:

If I understood your question correctly, I think you should try to use IAuthFunctions to override CKAN’s built-in authentication. This interface allows custom authentication methods to be integrated into CKAN.

Answered By: Zoran Pandovski
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.