@@ -110,16 +110,16 @@ trait OAuth2BaseProvider extends Results {
110110trait OAuth2Provider extends OAuth2BaseProvider {
111111
112112 /**
113- * Issue access token in DataHandler process and return the response to client.
113+ * Issue access token in AuthorizationHandler process and return the response to client.
114114 *
115- * @param dataHandler Implemented DataHander for register access token to your system.
115+ * @param handler Implemented AuthorizationHandler for register access token to your system.
116116 * @param request Playframework is provided HTTP request interface.
117117 * @tparam A play.api.mvc.Request has type.
118118 * @return Request is successful then return JSON to client in OAuth 2.0 format.
119119 * Request is failed then return BadRequest or Unauthorized status to client with cause into the JSON.
120120 */
121- def issueAccessToken [A , U ](dataHandler : DataHandler [U ], timeout : Duration = 60 .seconds)(implicit request : Request [A ]): Result = {
122- val f = tokenEndpoint.handleRequest(request, dataHandler ).map {
121+ def issueAccessToken [A , U ](handler : AuthorizationHandler [U ], timeout : Duration = 60 .seconds)(implicit request : Request [A ]): Result = {
122+ val f = tokenEndpoint.handleRequest(request, handler ).map {
123123 case Left (e) if e.statusCode == 400 => BadRequest (responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e))
124124 case Left (e) if e.statusCode == 401 => Unauthorized (responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e))
125125 case Right (r) => Ok (Json .toJson(responseAccessToken(r))).withHeaders(" Cache-Control" -> " no-store" , " Pragma" -> " no-cache" )
@@ -129,17 +129,17 @@ trait OAuth2Provider extends OAuth2BaseProvider {
129129 }
130130
131131 /**
132- * Authorize to already created access token in DataHandler process and return the response to client.
132+ * Authorize to already created access token in ProtectedResourceHandler process and return the response to client.
133133 *
134- * @param dataHandler Implemented DataHander for authenticate to your system.
134+ * @param handler Implemented ProtectedResourceHandler for authenticate to your system.
135135 * @param callback Callback is called when authentication is successful.
136136 * @param request Playframework is provided HTTP request interface.
137137 * @tparam A play.api.mvc.Request has type.
138138 * @return Authentication is successful then the response use your API result.
139139 * Authentication is failed then return BadRequest or Unauthorized status to client with cause into the JSON.
140140 */
141- def authorize [A , U ](dataHandler : DataHandler [U ], timeout : Duration = 60 .seconds)(callback : AuthInfo [U ] => Result )(implicit request : Request [A ]): Result = {
142- val f = protectedResource.handleRequest(request, dataHandler ).map {
141+ def authorize [A , U ](handler : ProtectedResourceHandler [U ], timeout : Duration = 60 .seconds)(callback : AuthInfo [U ] => Result )(implicit request : Request [A ]): Result = {
142+ val f = protectedResource.handleRequest(request, handler ).map {
143143 case Left (e) if e.statusCode == 400 => BadRequest .withHeaders(responseOAuthErrorHeader(e))
144144 case Left (e) if e.statusCode == 401 => Unauthorized .withHeaders(responseOAuthErrorHeader(e))
145145 case Right (authInfo) => callback(authInfo)
@@ -183,34 +183,34 @@ trait OAuth2Provider extends OAuth2BaseProvider {
183183trait OAuth2AsyncProvider extends OAuth2BaseProvider {
184184
185185 /**
186- * Issue access token in DataHandler process and return the response to client.
186+ * Issue access token in AuthorizationHandler process and return the response to client.
187187 *
188- * @param dataHandler Implemented DataHander for register access token to your system.
188+ * @param handler Implemented AuthorizationHandler for register access token to your system.
189189 * @param request Playframework is provided HTTP request interface.
190190 * @tparam A play.api.mvc.Request has type.
191191 * @return Request is successful then return JSON to client in OAuth 2.0 format.
192192 * Request is failed then return BadRequest or Unauthorized status to client with cause into the JSON.
193193 */
194- def issueAccessToken [A , U ](dataHandler : DataHandler [U ])(implicit request : Request [A ]): Future [Result ] = {
195- tokenEndpoint.handleRequest(request, dataHandler ).map {
194+ def issueAccessToken [A , U ](handler : AuthorizationHandler [U ])(implicit request : Request [A ]): Future [Result ] = {
195+ tokenEndpoint.handleRequest(request, handler ).map {
196196 case Left (e) if e.statusCode == 400 => BadRequest (responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e))
197197 case Left (e) if e.statusCode == 401 => Unauthorized (responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e))
198198 case Right (r) => Ok (Json .toJson(responseAccessToken(r))).withHeaders(" Cache-Control" -> " no-store" , " Pragma" -> " no-cache" )
199199 }
200200 }
201201
202202 /**
203- * Authorize to already created access token in DataHandler process and return the response to client.
203+ * Authorize to already created access token in ProtectedResourceHandler process and return the response to client.
204204 *
205- * @param dataHandler Implemented DataHander for authenticate to your system.
205+ * @param handler Implemented ProtectedResourceHandler for authenticate to your system.
206206 * @param callback Callback is called when authentication is successful.
207207 * @param request Playframework is provided HTTP request interface.
208208 * @tparam A play.api.mvc.Request has type.
209209 * @return Authentication is successful then the response use your API result.
210210 * Authentication is failed then return BadRequest or Unauthorized status to client with cause into the JSON.
211211 */
212- def authorize [A , U ](dataHandler : DataHandler [U ])(callback : AuthInfo [U ] => Future [Result ])(implicit request : Request [A ]): Future [Result ] = {
213- protectedResource.handleRequest(request, dataHandler ).flatMap {
212+ def authorize [A , U ](handler : ProtectedResourceHandler [U ])(callback : AuthInfo [U ] => Future [Result ])(implicit request : Request [A ]): Future [Result ] = {
213+ protectedResource.handleRequest(request, handler ).flatMap {
214214 case Left (e) if e.statusCode == 400 => Future .successful(BadRequest .withHeaders(responseOAuthErrorHeader(e)))
215215 case Left (e) if e.statusCode == 401 => Future .successful(Unauthorized .withHeaders(responseOAuthErrorHeader(e)))
216216 case Right (authInfo) => callback(authInfo)
0 commit comments