[Seaside] Multiple users management
Cees De Groot
cdegroot at gmail.com
Wed Nov 16 11:05:19 CET 2005
On 11/16/05, Frederic Pluquet <fpluquet at ulb.ac.be> wrote:
> - If I want have a lot of users that manipulate my application on Seaside (with password), I must extend the WAAuthMain and override the verifyPassword: forUser:. Is that correct ? Is it the simplest solution ?
There is a WAAuthenticator class that does the actual password
verification. You can plug it into the authorization dialog, so you
can plug in your own authenticator. There's only one method,
#verifyPassword:for: that it needs to implement, so it doesn't need to
be a subclass of WAAuthenticator. So you do something like:
self call: (WALoginDialog new authenticator: MyAuthenticator new)
this will return nil or a user - where 'user' is whatever your
authenticator returns.
To keep the user around, you can subclass WASession and give it a
'user' instance var. So the whole thing could become something like:
MyComponent>>login
self session user: (self call: (WALoginDialog new authenticator:
MyAuthenticator new))
MyComponent>>logout
self session user: nil
MyComponent>>renderContentOn: html
self sesion user
ifNil: [
html anchorWithAction: [self login] text: 'Login']
ifNotNil: [
html anchorWithAction: [self logout] text: 'Logout']
... your other html stuff here ...
More information about the Seaside
mailing list