Skip to content

Commit aefa576

Browse files
committed
Merge branch 'optional-clientsecret'
2 parents 1a54cd4 + 487008e commit aefa576

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ case class User(id: Long, name: String, hashedPassword: String)
5757

5858
class MyDataHandler extends DataHandler[User] {
5959

60-
def validateClient(clientId: String, clientSecret: String, grantType: String): Future[Boolean] = ???
60+
def validateClient(clientCredential: ClientCredential, grantType: String): Future[Boolean] = ???
6161

6262
def findUser(username: String, password: String): Future[Option[User]] = ???
6363

@@ -71,7 +71,7 @@ class MyDataHandler extends DataHandler[User] {
7171

7272
def findAuthInfoByRefreshToken(refreshToken: String): Future[Option[AuthInfo[User]]] = ???
7373

74-
def findClientUser(clientId: String, clientSecret: String, scope: Option[String]): Future[Option[User]] = ???
74+
def findClientUser(clientCredential: ClientCredential, scope: Option[String]): Future[Option[User]] = ???
7575

7676
def findAccessToken(token: String): Future[Option[AccessToken]] = ???
7777

@@ -84,6 +84,26 @@ If your data access is blocking for the data storage, then you just wrap your im
8484

8585
For more details, refer to Scaladoc of ```DataHandler```.
8686

87+
### AuthInfo
88+
89+
```DataHandler``` returns ```AuthInfo``` as authorized information.
90+
```AuthInfo``` is made up of the following fields.
91+
92+
```
93+
case class AuthInfo[User](user: User, clientId: Option[String], scope: Option[String], redirectUri: Option[String])
94+
```
95+
96+
- user
97+
- ```user``` is authorized by DataHandler
98+
- clientId
99+
- ```clientId``` which is sent from a client has been verified by ```DataHandler```
100+
- If your application requires client_id for client authentication, you can get ```clientId``` as below
101+
- ```val clientId = authInfo.clientId.getOrElse(throw new InvalidClient())```
102+
- scope
103+
- inform the client of the scope of the access token issued
104+
- redirectUri
105+
- This value must be enabled on authorization code grant
106+
87107
### Work with Playframework
88108

89109
You should follow three steps below to work with Playframework.

0 commit comments

Comments
 (0)