-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Raphael Slinckx wrote:
> New submission from Raphael Slinckx <r.slin...@whatever-company.com>:
> 
> I can't find a way to setup identity programmatically.
> 
> I have a registration controller that creates a user in a database, when the
> registration controller returns I want the user to be authenticated just like 
> if
> would have logged-in through the login form.
> 
> It seems repoze.who doens't allow to programmatically set identity from python
> code inside a request, and thus the auth cookie isn't sent back from the 
> controller.
> 
> After a quick glance at the code, the identity is set to None if the user is
> anonymous, and then the remember phase of repoze is run with no identity so it
> doesn nothing, and since i can't assign an identity from my controller code, 
> it
> seems impossible.
he
You should be able to do this from application code by calling the
'remember' method of your "identifier" plugin.  Something like (untested)::

  plugins = environ['repoze.who.plugins']
  identifier = plugins['<your plugin name here>']
  headers = identifier.remember(environ, identity)

and then append those headers to your response.  The 'identity' mapping
should have whatever keys your plugin's 'remember' method requires.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tsea...@palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkW32+gerLs4ltQ4RAvNUAKCsTU5vYPh2g6SI+wOnit9n9I5EGQCeNiCk
3NKoR6WVeGWFw4gW+W/81MI=
=uslN
-----END PGP SIGNATURE-----
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to