Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
documentation:latest:plugincustom [2019/04/08 15:35] coudot [Plugin Perl module] |
documentation:latest:plugincustom [2019/05/02 15:11] coudot [Presentation] |
||
---|---|---|---|
Line 11: | Line 11: | ||
* ''forAuthUser'': method called for already authenticated users | * ''forAuthUser'': method called for already authenticated users | ||
* ''beforeLogout'': method called before logout | * ''beforeLogout'': method called before logout | ||
+ | |||
+ | If you need to call a method just after any standard method in authentication process, then use ''afterSub'', for example: | ||
+ | <code perl> | ||
+ | use constant afterSub => { | ||
+ | getUser => 'mysub', | ||
+ | } | ||
+ | sub mysub { | ||
+ | my ( $self ,$req ) = @_; | ||
+ | # Do something | ||
+ | return PE_OK; | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | If you need to call a method instead any standard method in authentication process, then use ''aroundSub'', for example: | ||
+ | <code perl> | ||
+ | use constant aroundSub => { | ||
+ | getUser => 'mysub', | ||
+ | }; | ||
+ | sub mysub { | ||
+ | my ( $self, $sub, $req ) = @_; | ||
+ | # Do something before | ||
+ | my $ret = $sub->($req); | ||
+ | # Do something after | ||
+ | return $ret; | ||
+ | } | ||
+ | </code> | ||
The plugin can also define new routes and call actions on them. | The plugin can also define new routes and call actions on them. |