Skip to content

Commit b43a66f

Browse files
committed
renamed reAuth to reconnect
1 parent 089ebd0 commit b43a66f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ You can also change the `url` variable, used to test the API with authentication
768768

769769
[More info](https://firebase.google.com/docs/auth/admin/verify-id-tokens#verify_id_tokens_using_a_third-party_jwt_library)
770770

771-
## Authorizing operations
771+
### Authorizing operations
772772

773773
The Authorization model acts on "operations". The most important ones are listed here:
774774

@@ -815,6 +815,23 @@ This construct adds a filter to every executed query.
815815

816816
NB: You need to handle the creation of invalid records with a validation (or sanitation) handler.
817817

818+
### SQL GRANT authorization
819+
820+
You can alternatively use database permissons (SQL GRANT statements) to define the authorization model. In this case you
821+
should not use the "authorization" middleware, but you do need to use the "reconnect" middleware. The handlers of the
822+
"reconnect" middleware allow you to specify the correct username and password, like this:
823+
824+
'reconnect.usernameHandler' => function () {
825+
return 'mevdschee';
826+
},
827+
'reconnect.passwordHandler' => function () {
828+
return 'secret123';
829+
},
830+
831+
This will make the API connect to the database specifying "mevdschee" as the username and "secret123" as the password.
832+
833+
NB: You may want to retrieve the username and password from the session (the "$_SESSION" variable).
834+
818835
### Sanitizing input
819836

820837
By default all input is accepted and sent to the database. If you want to strip (certain) HTML tags before storing you may add

0 commit comments

Comments
 (0)