Skip to content

Commit 12b5890

Browse files
authored
Updated README for new property (loginTable)
Included usage/dpcumentation for the added property for dbAuthentication middleware
1 parent bb0f163 commit 12b5890

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ You can tune the middleware behavior using middleware specific configuration par
698698
- "apiKeyDbAuth.apiKeyColumn": The users table column that holds the API key ("api_key")
699699
- "dbAuth.mode": Set to "optional" if you want to allow anonymous access ("required")
700700
- "dbAuth.usersTable": The table that is used to store the users in ("users")
701+
- "dbAuth.loginTable": The table or view that is used to retrieve the users info for login
701702
- "dbAuth.usernameColumn": The users table column that holds usernames ("username")
702703
- "dbAuth.passwordColumn": The users table column that holds passwords ("password")
703704
- "dbAuth.returnedColumns": The columns returned on successful login, empty means 'all' ("")
@@ -826,6 +827,13 @@ users can freely add, modify or delete any account! The minimal configuration is
826827

827828
Note that this middleware uses session cookies and stores the logged in state on the server.
828829

830+
**Login using views with joined table**
831+
832+
For login operations, it is possible to use a view as the usersTable. Such view can return a filtered result from the users table, e.g., *where active = true* or it may also return a result multiple tables thru a table join. At a minimum, the view should include the ***username*** and ***password***.
833+
834+
However, views with joined tables are not insertable ([see issue 907](https://github.com/mevdschee/php-crud-api/issues/907) ). As a workaround, use the property ***loginTable*** to set a different reference table for login. The **usersTable** will still be set to the normal, insertable users table.
835+
836+
829837
#### Basic authentication
830838

831839
The Basic type supports a file (by default '.htpasswd') that holds the users and their (hashed) passwords separated by a colon (':').

0 commit comments

Comments
 (0)