Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
63176ec4
Commit
63176ec4
authored
Jan 19, 2015
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Auth Clients guide fixes
parent
074f9ac0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
security-auth-clients.md
docs/guide/security-auth-clients.md
+3
-3
No files found.
docs/guide/security-auth-clients.md
View file @
63176ec4
...
...
@@ -90,12 +90,12 @@ CREATE TABLE auth (
);
ALTER
TABLE
auth
ADD
CONSTRAINT
fk
-
auth
-
user_id
-
user
-
id
FOREIGN
KEY
user_id
REFERENCES
auth
(
id
);
FOREIGN
KEY
user_id
REFERENCES
user
(
id
);
```
In the SQL above
`user`
is a standard table that is used in advanced application template to store user
info. Each user can authenticate using multiple external services therefore each
`user`
record can relate to
multiple
`auth`
records. In the
`auth`
table
`
client_name`
is the name of the auth provider used and
`client
_id`
is
multiple
`auth`
records. In the
`auth`
table
`
source`
is the name of the auth provider used and
`source
_id`
is
unique user identificator that is provided by external service after successful login.
Using tables created above we can generate
`Auth`
model. No further adjustments needed.
...
...
@@ -183,8 +183,8 @@ class SiteController extends Controller
we can retrieve information received. In our case we'd like to:
-
If user is guest and record found in auth then log this user in.
-
If user is logged in and record found in auth then try connecting additional account (save its data into auth table).
-
If user is guest and record not found in auth then create new user and make a record in auth table. Then log in.
-
If user is logged in and record not found in auth then try connecting additional account (save its data into auth table).
Although, all clients are different they shares same basic interface
[
[yii\authclient\ClientInterface
]
],
which governs common API.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment