Hey,

OAuth differentiates between three types of classes:
* 'service' classes: do not contain state related to a single session, and
can thus be shared; in our examples we do that by making them global
objects accessed through static member functions
* 'model' classes: contain state related to a single session, and thus
cannot be shared
* 'widgets': are Wt widets

There's no obligation to organize your code as we do in our examples; Wt
auth very much acts as a library.

In the examples we usually abstract everything related to authentication
and database access in a single 'Session' class, which is then at the same
time a Dbo::Session as the entry point to authentication services.

As to:
/usr/include/Wt/Auth/FormBaseModel:58: note:   no known conversion for
argument 1 from 'const Wt::Auth::PasswordService*' to 'const
Wt::Auth::AbstractPasswordService*'

This is a typical complaint you get if you are not including
<Wt/Auth/PasswordService> (in this case) and thus the compiler does not
know that PasswordService specializes AbstractPasswordService.

Regards,
koen



2014-03-26 22:50 GMT+01:00 Jason H <[email protected]>:

> http://www.webtoolkit.eu/wt/doc/tutorial/auth.html
> I'm working through the docs trying t learn this...
>
> 1. Is Session::configureAuth() supposed to be static? I'm also looking at
> hangman example.  ( http://www.webtoolkit.eu/wt/src ) which uses it
> statically.
> 2. Are all the Session.C files the same file?
> 3, Hangman uses:
>
> Session::Session()
>   : sqlite3_(WApplication::instance()->appRoot() + "hangman.db")
>
> But the docs use:
>
> Session::Session(const std::string& sqliteDb)
>   : connection_(sqliteDb)
>
>
> I prefer the second (less hardcoding), but then you can't use Session as a 
> class member, you have to use it as a pointer and create it in your 
> application class constructor.
>
>
> 4. it looks like we need more statics for auth() passwordAuth() and oAuth() 
> too.
>
>
> 5. Finally an error I cannot figure out, 
> authWidget->model()->addPasswordAuth(&Session::passwordAuth()); gives me:
>
> /usr/include/Wt/Auth/FormBaseModel:58: note:   no known conversion for 
> argument 1 from 'const Wt::Auth::PasswordService*' to 'const 
> Wt::Auth::AbstractPasswordService*'
>
> where I have:
>
>
> Wt::Auth::PasswordService myPasswordService(myAuthService)
>
> const Auth::PasswordService& AuthSession::passwordAuth(){  return 
> myPasswordService;}
>
> many thanks in advance.
>
>
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to