1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2018 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.api.technical.auth
21 
22 import java.util.Date
23 import java.util.concurrent.TimeUnit
24 import com.google.common.cache.{Cache, CacheBuilder}
25 import grizzled.slf4j.Logging
26 import org.make.api.extensions.MakeSettingsComponent
27 import org.make.api.technical.auth.MakeDataHandler.{CreatedAtParameter, RefreshTokenExpirationParameter}
28 import org.make.api.technical.{IdGeneratorComponent, ShortenedNames}
29 import org.make.api.user.PersistentUserServiceComponent
30 import org.make.core.DateHelper
31 import org.make.core.auth._
32 import org.make.core.user.{User, UserId}
33 import scalaoauth2.provider._
34 
35 import scala.concurrent.ExecutionContext.Implicits.global
36 import scala.concurrent.Future
37 import scala.util.Success
38 
39 trait DefaultMakeDataHandlerComponent extends MakeDataHandlerComponent with Logging with ShortenedNames {
40   this: PersistentTokenServiceComponent
41     with PersistentUserServiceComponent
42     with ClientServiceComponent
43     with OauthTokenGeneratorComponent
44     with IdGeneratorComponent
45     with PersistentAuthCodeServiceComponent
46     with MakeSettingsComponent =>
47 
48   override lazy val oauth2DataHandler = new DefaultMakeDataHandler
49 
50   class DefaultMakeDataHandler extends MakeDataHandler {
51 
52     private val accessTokenCache: Cache[String, Token] =
53       CacheBuilder
54         .newBuilder()
55         .expireAfterWrite(5, TimeUnit.MINUTES)
56         .build[String, Token]()
57 
58     private val authInfoByAccessTokenCache: Cache[String, AuthInfo[UserRights]] =
59       CacheBuilder
60         .newBuilder()
61         .expireAfterWrite(5, TimeUnit.MINUTES)
62         .build[String, AuthInfo[UserRights]]()
63 
64     private def toAccessToken(token: Token): AccessToken = {
65       AccessToken(
66         token = token.accessToken,
67         refreshToken = token.refreshToken,
68         scope = token.scope,
69         lifeSeconds = Some(token.expiresIn.toLong),
70         createdAt = Date.from(token.createdAt.getOrElse(DateHelper.now()).toInstant),
71         params = Map(
72           CreatedAtParameter -> DateHelper.format(token.createdAt.getOrElse(DateHelper.now())),
73           RefreshTokenExpirationParameter -> token.refreshExpiresIn.toString
74         )
75       )
76     }
77 
78     private def userIsRelatedToClient(client: Client)(user: User): Boolean =
79       client.roles.isEmpty || user.roles.exists(client.roles.contains)
80 
81     override def validateClient(
82       maybeCredential: Option[ClientCredential],
83       request: AuthorizationRequest
84     ): Future[Boolean] = {
85       findClient(maybeCredential, request.grantType).map(_.isRight)
86     }
87 
88     private def findUser(client: Client, request: AuthorizationRequest): Future[Option[User]] = {
89       val eventualMaybeUser: Future[Option[User]] = request match {
90         case passwordRequest: PasswordRequest =>
91           persistentUserService
92             .findByEmailAndPassword(passwordRequest.username.toLowerCase, passwordRequest.password)
93         case reconnectRequest: ReconnectRequest =>
94           persistentUserService
95             .findByReconnectTokenAndPassword(
96               reconnectRequest.reconnectToken,
97               reconnectRequest.password,
98               client.reconnectExpirationSeconds
99             )
100         case _: ClientCredentialsRequest =>
101           client.defaultUserId match {
102             case Some(userId) => persistentUserService.get(userId)
103             case None         => Future.successful(None)
104           }
105         case _ => Future.successful(None)
106       }
107 
108       eventualMaybeUser.flatMap {
109         case Some(user) if !userIsRelatedToClient(client)(user) =>
110           Future.failed(new AccessDenied(MakeDataHandler.insufficientRole(user, client)))
111         case other => Future.successful(other)
112       }
113     }
114 
115     private def findClient(
116       maybeCredentials: Option[ClientCredential],
117       grantType: String
118     ): Future[Either[OAuthError, Client]] = {
119       (maybeCredentials match {
120         case None =>
121           // Do not use the default client when using the client credential grant type
122           if (grantType == OAuthGrantType.CLIENT_CREDENTIALS) {
123             Future.successful(
124               Left(new InvalidRequest("Client credentials are mandatory for the client_credentials grant type"))
125             )
126           } else {
127             clientService.getDefaultClient()
128           }
129         case Some(credentials) =>
130           clientService.getClient(ClientId(credentials.clientId), credentials.clientSecret)
131       }).map {
132         case Right(client) =>
133           if (client.allowedGrantTypes.contains(grantType)) {
134             Right(client)
135           } else {
136             Left(new UnauthorizedClient(s"Grant type $grantType is not allowed for this client"))
137           }
138         case error => error
139       }
140     }
141 
142     override def findUser(
143       maybeCredential: Option[ClientCredential],
144       request: AuthorizationRequest
145     ): Future[Option[UserRights]] = {
146 
147       findClient(maybeCredential, request.grantType).flatMap {
148         case Right(client) => findUser(client, request).map(_.map(UserRights.fromUser))
149         case Left(e)       => Future.failed(e)
150       }
151     }
152 
153     override def createAccessToken(authInfo: AuthInfo[UserRights]): Future[AccessToken] = {
154       val futureAccessTokens = oauthTokenGenerator.generateAccessToken()
155       val futureRefreshTokens = oauthTokenGenerator.generateRefreshToken()
156 
157       val clientId: String = authInfo.clientId.getOrElse(makeSettings.Authentication.defaultClientId)
158 
159       val futureClient = clientService.getClient(ClientId(clientId))
160       val futureResult: Future[Token] = for {
161         (accessToken, _)  <- futureAccessTokens
162         (refreshToken, _) <- futureRefreshTokens
163         maybeClient       <- futureClient
164         client <- maybeClient.fold(Future.failed[Client](new InvalidClient(s"Client with id $clientId not found")))(
165           Future.successful
166         )
167       } yield {
168         val maybeRefreshToken =
169           if (client.allowedGrantTypes.contains(OAuthGrantType.REFRESH_TOKEN)) {
170             Some(refreshToken)
171           } else {
172             None
173           }
174 
175         Token(
176           accessToken = accessToken,
177           refreshToken = maybeRefreshToken,
178           scope = None,
179           expiresIn = client.tokenExpirationSeconds,
180           refreshExpiresIn = client.refreshExpirationSeconds,
181           user = authInfo.user,
182           client = client
183         )
184       }
185 
186       futureResult
187         .flatMap(persistentTokenService.persist)
188         .map(toAccessToken)
189     }
190 
191     override def getStoredAccessToken(authInfo: AuthInfo[UserRights]): Future[Option[AccessToken]] = {
192       // Force to issue a fresh token every time a user connects.
193       // This way, authentication will not be shared across devices
194       Future.successful(None)
195     }
196 
197     override def refreshAccessToken(authInfo: AuthInfo[UserRights], refreshToken: String): Future[AccessToken] = {
198       def findByRefreshTokenOrFail(refreshToken: String): Future[Token] =
199         persistentTokenService.findByRefreshToken(refreshToken).flatMap {
200           case Some(token) => Future.successful(token)
201           case None        => Future.failed(TokenAlreadyRefreshed(refreshToken))
202         }
203 
204       for {
205         token       <- findByRefreshTokenOrFail(refreshToken)
206         _           <- persistentTokenService.deleteByAccessToken(token.accessToken)
207         accessToken <- createAccessToken(authInfo)
208       } yield accessToken
209     }
210 
211     override def findAuthInfoByCode(code: String): Future[Option[AuthInfo[UserRights]]] = {
212       persistentAuthCodeService.findByCode(code).flatMap {
213         case None => Future.successful(None)
214         case Some(authCode) =>
215           clientService.getClient(authCode.client).flatMap {
216             case Some(client) =>
217               persistentUserService
218                 .get(authCode.user)
219                 .flatMap {
220                   case Some(user) if userIsRelatedToClient(client)(user) =>
221                     Future.successful(
222                       Some(
223                         AuthInfo(
224                           user = UserRights(user.userId, user.roles, user.availableQuestions, user.emailVerified),
225                           clientId = Some(authCode.client.value),
226                           scope = authCode.scope,
227                           redirectUri = authCode.redirectUri
228                         )
229                       )
230                     )
231                   case None => Future.successful(None)
232                   case Some(user) =>
233                     Future.failed(new AccessDenied(MakeDataHandler.insufficientRole(user, client)))
234                 }
235             case _ => Future.successful(None)
236           }
237       }
238     }
239 
240     override def deleteAuthCode(code: String): Future[Unit] = {
241       persistentAuthCodeService.deleteByCode(code)
242     }
243 
244     override def findAuthInfoByRefreshToken(refreshToken: String): Future[Option[AuthInfo[UserRights]]] = {
245       persistentTokenService.findByRefreshToken(refreshToken).flatMap {
246         case Some(token) if !token.isRefreshTokenExpired =>
247           Future.successful(
248             Some(
249               AuthInfo(
250                 user = token.user,
251                 clientId = Some(token.client.clientId.value),
252                 scope = token.scope,
253                 redirectUri = None
254               )
255             )
256           )
257         case _ => Future.successful(None)
258       }
259     }
260 
261     override def findAuthInfoByAccessToken(accessToken: AccessToken): Future[Option[AuthInfo[UserRights]]] = {
262       Option(authInfoByAccessTokenCache.getIfPresent(accessToken.token))
263         .map(authInfo => Future.successful(Some(authInfo)))
264         .getOrElse {
265           persistentTokenService.get(accessToken.token).flatMap[Option[AuthInfo[UserRights]]] {
266             case Some(token) =>
267               val authInfo = AuthInfo(
268                 user = token.user,
269                 clientId = Some(token.client.clientId.value),
270                 scope = token.scope,
271                 redirectUri = None
272               )
273               authInfoByAccessTokenCache.put(accessToken.token, authInfo)
274               Future.successful(Some(authInfo))
275             case None => Future.successful(None)
276           }
277         }
278     }
279 
280     override def findAccessToken(token: String): Future[Option[AccessToken]] = {
281       Option(accessTokenCache.getIfPresent(token))
282         .filter(!_.isAccessTokenExpired)
283         .map(token => Future.successful(Some(token)))
284         .getOrElse {
285           val future = persistentTokenService
286             .get(token)
287             .map(_.filter(!_.isAccessTokenExpired))
288           future.onComplete {
289             case Success(Some(userToken)) => accessTokenCache.put(token, userToken)
290             case _                        =>
291           }
292           future
293         }
294         .map(_.map(toAccessToken))
295     }
296 
297     override def removeTokenByUserId(userId: UserId): Future[Int] = {
298       persistentTokenService.deleteByUserId(userId)
299     }
300 
301     override def createAuthorizationCode(
302       userId: UserId,
303       clientId: ClientId,
304       scope: Option[String],
305       redirectUri: Option[String]
306     ): Future[Option[AuthCode]] = {
307 
308       clientService.getClient(clientId).flatMap {
309         case None => Future.successful(None)
310         case Some(client) =>
311           persistentUserService.get(userId).flatMap {
312             case None => Future.successful(None)
313             case Some(user) if userIsRelatedToClient(client)(user) =>
314               persistentAuthCodeService
315                 .persist(
316                   AuthCode(
317                     authorizationCode = idGenerator.nextId(),
318                     scope = scope,
319                     redirectUri = redirectUri,
320                     createdAt = DateHelper.now(),
321                     expiresIn = client.tokenExpirationSeconds,
322                     user = userId,
323                     client = clientId
324                   )
325                 )
326                 .map(Some(_))
327             case Some(user) =>
328               Future.failed(new AccessDenied(MakeDataHandler.insufficientRole(user, client)))
329           }
330       }
331     }
332 
333     override def refreshIfTokenIsExpired(tokenValue: String): Future[Option[Token]] = {
334       Option(accessTokenCache.getIfPresent(tokenValue))
335         .map(token => Future.successful(Some(token)))
336         .getOrElse {
337           persistentTokenService.get(tokenValue)
338         }
339         .flatMap {
340           case Some(token @ Token(_, Some(refreshToken), _, _, _, _, _, _, _))
341               if token.isAccessTokenExpired &&
342                 !token.isRefreshTokenExpired =>
343             findAuthInfoByAccessToken(toAccessToken(token)).flatMap {
344               case Some(authInfo) =>
345                 refreshAccessToken(authInfo, refreshToken)
346                   .flatMap(token => persistentTokenService.get(token.token))
347               case _ => Future.successful(None)
348             }
349           case _ => Future.successful(None)
350         }
351     }
352 
353     override def removeToken(token: String): Future[Unit] = {
354       persistentTokenService.deleteByAccessToken(token).map(_ => accessTokenCache.invalidate(token))
355     }
356   }
357 }
358 
359 final case class TokenAlreadyRefreshed(refreshToken: String)
360     extends Exception(s"Refresh token $refreshToken has already been refreshed")
Line Stmt Id Pos Tree Symbol Tests Code
56 26283 2009 - 2122 Apply com.google.common.cache.CacheBuilder.build org.make.api.technical.auth.makedatahandlercomponenttest com.google.common.cache.CacheBuilder.newBuilder().expireAfterWrite(5L, MINUTES).build[String, org.make.core.auth.Token]()
62 24914 2212 - 2340 Apply com.google.common.cache.CacheBuilder.build org.make.api.technical.auth.makedatahandlercomponenttest com.google.common.cache.CacheBuilder.newBuilder().expireAfterWrite(5L, MINUTES).build[String, scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]()
65 26268 2409 - 2879 Apply scalaoauth2.provider.AccessToken.apply scalaoauth2.provider.AccessToken.apply(token.accessToken, token.refreshToken, token.scope, scala.Some.apply[Long](token.expiresIn.toLong), java.util.Date.from(token.createdAt.getOrElse[java.time.ZonedDateTime](org.make.core.DateHelper.now()).toInstant()), scala.Predef.Map.apply[String, String](scala.Predef.ArrowAssoc[String](org.make.api.technical.auth.MakeDataHandler.CreatedAtParameter).->[String](org.make.core.DateHelper.format(token.createdAt.getOrElse[java.time.ZonedDateTime](org.make.core.DateHelper.now()))), scala.Predef.ArrowAssoc[String](org.make.api.technical.auth.MakeDataHandler.RefreshTokenExpirationParameter).->[String](token.refreshExpiresIn.toString())))
66 22737 2438 - 2455 Select org.make.core.auth.Token.accessToken token.accessToken
67 26409 2480 - 2498 Select org.make.core.auth.Token.refreshToken token.refreshToken
68 24309 2516 - 2527 Select org.make.core.auth.Token.scope token.scope
69 26791 2551 - 2579 Apply scala.Some.apply scala.Some.apply[Long](token.expiresIn.toLong)
69 27980 2556 - 2578 Select scala.Int.toLong token.expiresIn.toLong
70 24618 2611 - 2664 Apply java.time.chrono.ChronoZonedDateTime.toInstant token.createdAt.getOrElse[java.time.ZonedDateTime](org.make.core.DateHelper.now()).toInstant()
70 22264 2601 - 2665 Apply java.util.Date.from java.util.Date.from(token.createdAt.getOrElse[java.time.ZonedDateTime](org.make.core.DateHelper.now()).toInstant())
71 22576 2684 - 2871 Apply scala.collection.MapFactory.apply scala.Predef.Map.apply[String, String](scala.Predef.ArrowAssoc[String](org.make.api.technical.auth.MakeDataHandler.CreatedAtParameter).->[String](org.make.core.DateHelper.format(token.createdAt.getOrElse[java.time.ZonedDateTime](org.make.core.DateHelper.now()))), scala.Predef.ArrowAssoc[String](org.make.api.technical.auth.MakeDataHandler.RefreshTokenExpirationParameter).->[String](token.refreshExpiresIn.toString()))
72 23876 2765 - 2781 Apply org.make.core.DefaultDateHelper.now org.make.core.DateHelper.now()
72 24154 2699 - 2783 Apply scala.Predef.ArrowAssoc.-> scala.Predef.ArrowAssoc[String](org.make.api.technical.auth.MakeDataHandler.CreatedAtParameter).->[String](org.make.core.DateHelper.format(token.createdAt.getOrElse[java.time.ZonedDateTime](org.make.core.DateHelper.now())))
72 26711 2721 - 2783 Apply org.make.core.DefaultDateHelper.format org.make.core.DateHelper.format(token.createdAt.getOrElse[java.time.ZonedDateTime](org.make.core.DateHelper.now()))
72 22747 2739 - 2782 Apply scala.Option.getOrElse token.createdAt.getOrElse[java.time.ZonedDateTime](org.make.core.DateHelper.now())
72 26207 2699 - 2717 Select org.make.api.technical.auth.MakeDataHandler.CreatedAtParameter org.make.api.technical.auth.MakeDataHandler.CreatedAtParameter
73 26803 2830 - 2861 Apply scala.Any.toString token.refreshExpiresIn.toString()
73 27906 2795 - 2826 Select org.make.api.technical.auth.MakeDataHandler.RefreshTokenExpirationParameter org.make.api.technical.auth.MakeDataHandler.RefreshTokenExpirationParameter
73 24840 2795 - 2861 Apply scala.Predef.ArrowAssoc.-> scala.Predef.ArrowAssoc[String](org.make.api.technical.auth.MakeDataHandler.RefreshTokenExpirationParameter).->[String](token.refreshExpiresIn.toString())
79 22676 2994 - 3034 Apply scala.collection.IterableOnceOps.exists user.roles.exists(((elem: Any) => client.roles.contains[Any](elem)))
79 26719 2970 - 3034 Apply scala.Boolean.|| client.roles.isEmpty.||(user.roles.exists(((elem: Any) => client.roles.contains[Any](elem))))
79 23791 3012 - 3033 Apply scala.collection.SeqOps.contains client.roles.contains[Any](elem)
85 26812 3237 - 3237 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
85 24772 3187 - 3248 ApplyToImplicitArgs scala.concurrent.Future.map DefaultMakeDataHandler.this.findClient(maybeCredential, request.grantType).map[Boolean](((x$1: Either[scalaoauth2.provider.OAuthError,org.make.core.auth.Client]) => x$1.isRight))(scala.concurrent.ExecutionContext.Implicits.global)
85 28130 3238 - 3247 Select scala.util.Either.isRight x$1.isRight
85 24466 3215 - 3232 Select scalaoauth2.provider.AuthorizationRequest.grantType request.grantType
92 26194 3577 - 3601 Select scalaoauth2.provider.PasswordRequest.password passwordRequest.password
92 24023 3481 - 3602 Apply org.make.api.user.PersistentUserService.findByEmailAndPassword DefaultMakeDataHandlerComponent.this.persistentUserService.findByEmailAndPassword(passwordRequest.username.toLowerCase(), passwordRequest.password)
92 22586 3539 - 3575 Apply java.lang.String.toLowerCase passwordRequest.username.toLowerCase()
95 28140 3664 - 3881 Apply org.make.api.user.PersistentUserService.findByReconnectTokenAndPassword DefaultMakeDataHandlerComponent.this.persistentUserService.findByReconnectTokenAndPassword(reconnectRequest.reconnectToken, reconnectRequest.password, client.reconnectExpirationSeconds)
96 22906 3746 - 3777 Select org.make.api.technical.auth.ReconnectRequest.reconnectToken reconnectRequest.reconnectToken
97 26652 3793 - 3818 Select org.make.api.technical.auth.ReconnectRequest.password reconnectRequest.password
98 24306 3834 - 3867 Select org.make.core.auth.Client.reconnectExpirationSeconds client.reconnectExpirationSeconds
101 25901 3936 - 3956 Select org.make.core.auth.Client.defaultUserId client.defaultUserId
102 24781 3998 - 4031 Apply org.make.api.user.PersistentUserService.get DefaultMakeDataHandlerComponent.this.persistentUserService.get(userId)
103 26202 4065 - 4088 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
103 22516 4083 - 4087 Select scala.None scala.None
105 24027 4137 - 4141 Select scala.None scala.None
105 22657 4119 - 4142 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
108 26214 4158 - 4397 ApplyToImplicitArgs scala.concurrent.Future.flatMap eventualMaybeUser.flatMap[Option[org.make.core.user.User]](((x0$1: Option[org.make.core.user.User]) => x0$1 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if DefaultMakeDataHandler.this.userIsRelatedToClient(client)(user).unary_! => scala.concurrent.Future.failed[Nothing](new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client))) case (other @ _) => scala.concurrent.Future.successful[Option[org.make.core.user.User]](other) }))(scala.concurrent.ExecutionContext.Implicits.global)
108 22364 4184 - 4184 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
109 26660 4213 - 4249 Select scala.Boolean.unary_! DefaultMakeDataHandler.this.userIsRelatedToClient(client)(user).unary_!
110 28072 4277 - 4341 Apply scalaoauth2.provider.AccessDenied.<init> new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client))
110 24243 4294 - 4340 Apply org.make.api.technical.auth.MakeDataHandler.insufficientRole MakeDataHandler.insufficientRole(user, client)
110 25759 4263 - 4342 Apply scala.concurrent.Future.failed scala.concurrent.Future.failed[Nothing](new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client)))
111 24541 4365 - 4389 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[Option[org.make.core.user.User]](other)
122 22670 4707 - 4753 Apply java.lang.Object.== org.make.api.technical.auth.makedatahandlercomponenttest grantType.==(scalaoauth2.provider.OAuthGrantType.`package`.CLIENT_CREDENTIALS)
122 23967 4720 - 4753 Select scalaoauth2.provider.OAuthGrantType.CLIENT_CREDENTIALS org.make.api.technical.auth.makedatahandlercomponenttest scalaoauth2.provider.OAuthGrantType.`package`.CLIENT_CREDENTIALS
123 25678 4769 - 4914 Block scala.concurrent.Future.successful org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.Future.successful[scala.util.Left[scalaoauth2.provider.InvalidRequest,Nothing]](scala.`package`.Left.apply[scalaoauth2.provider.InvalidRequest, Nothing](new scalaoauth2.provider.InvalidRequest("Client credentials are mandatory for the client_credentials grant type")))
123 28082 4769 - 4914 Apply scala.concurrent.Future.successful org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.Future.successful[scala.util.Left[scalaoauth2.provider.InvalidRequest,Nothing]](scala.`package`.Left.apply[scalaoauth2.provider.InvalidRequest, Nothing](new scalaoauth2.provider.InvalidRequest("Client credentials are mandatory for the client_credentials grant type")))
124 26424 4807 - 4899 Apply scalaoauth2.provider.InvalidRequest.<init> org.make.api.technical.auth.makedatahandlercomponenttest new scalaoauth2.provider.InvalidRequest("Client credentials are mandatory for the client_credentials grant type")
124 24255 4802 - 4900 Apply scala.util.Left.apply org.make.api.technical.auth.makedatahandlercomponenttest scala.`package`.Left.apply[scalaoauth2.provider.InvalidRequest, Nothing](new scalaoauth2.provider.InvalidRequest("Client credentials are mandatory for the client_credentials grant type"))
127 24554 4946 - 4978 Apply org.make.api.technical.auth.ClientService.getDefaultClient DefaultMakeDataHandlerComponent.this.clientService.getDefaultClient()
127 22499 4946 - 4978 Block org.make.api.technical.auth.ClientService.getDefaultClient DefaultMakeDataHandlerComponent.this.clientService.getDefaultClient()
130 23804 5059 - 5089 Apply org.make.core.auth.ClientId.apply org.make.api.technical.auth.makedatahandlercomponenttest org.make.core.auth.ClientId.apply(credentials.clientId)
130 26349 5068 - 5088 Select scalaoauth2.provider.ClientCredential.clientId org.make.api.technical.auth.makedatahandlercomponenttest credentials.clientId
130 26435 5035 - 5116 Apply org.make.api.technical.auth.ClientService.getClient org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandlerComponent.this.clientService.getClient(org.make.core.auth.ClientId.apply(credentials.clientId), credentials.clientSecret)
130 27538 5091 - 5115 Select scalaoauth2.provider.ClientCredential.clientSecret org.make.api.technical.auth.makedatahandlercomponenttest credentials.clientSecret
131 23954 5130 - 5130 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
131 27553 4560 - 5414 ApplyToImplicitArgs scala.concurrent.Future.map org.make.api.technical.auth.makedatahandlercomponenttest maybeCredentials match { case scala.None => if (grantType.==(scalaoauth2.provider.OAuthGrantType.`package`.CLIENT_CREDENTIALS)) scala.concurrent.Future.successful[scala.util.Left[scalaoauth2.provider.InvalidRequest,Nothing]](scala.`package`.Left.apply[scalaoauth2.provider.InvalidRequest, Nothing](new scalaoauth2.provider.InvalidRequest("Client credentials are mandatory for the client_credentials grant type"))) else DefaultMakeDataHandlerComponent.this.clientService.getDefaultClient() case (value: scalaoauth2.provider.ClientCredential): Some[scalaoauth2.provider.ClientCredential]((credentials @ _)) => DefaultMakeDataHandlerComponent.this.clientService.getClient(org.make.core.auth.ClientId.apply(credentials.clientId), credentials.clientSecret) }.map[Either[scalaoauth2.provider.OAuthError,org.make.core.auth.Client]](((x0$1: Either[scalaoauth2.provider.OAuthError,org.make.core.auth.Client]) => x0$1 match { case (value: org.make.core.auth.Client): scala.util.Right[scalaoauth2.provider.OAuthError,org.make.core.auth.Client]((client @ _)) => if (client.allowedGrantTypes.contains[String](grantType)) scala.`package`.Right.apply[Nothing, org.make.core.auth.Client](client) else scala.`package`.Left.apply[scalaoauth2.provider.UnauthorizedClient, Nothing](new scalaoauth2.provider.UnauthorizedClient(("Grant type ".+(grantType).+(" is not allowed for this client"): String))) case (error @ _) => error }))(scala.concurrent.ExecutionContext.Implicits.global)
133 24468 5176 - 5220 Apply scala.collection.SeqOps.contains client.allowedGrantTypes.contains[String](grantType)
134 28203 5236 - 5249 Apply scala.util.Right.apply scala.`package`.Right.apply[Nothing, org.make.core.auth.Client](client)
134 25690 5236 - 5249 Block scala.util.Right.apply scala.`package`.Right.apply[Nothing, org.make.core.auth.Client](client)
136 24851 5286 - 5365 Apply scalaoauth2.provider.UnauthorizedClient.<init> new scalaoauth2.provider.UnauthorizedClient(("Grant type ".+(grantType).+(" is not allowed for this client"): String))
136 22509 5281 - 5366 Apply scala.util.Left.apply scala.`package`.Left.apply[scalaoauth2.provider.UnauthorizedClient, Nothing](new scalaoauth2.provider.UnauthorizedClient(("Grant type ".+(grantType).+(" is not allowed for this client"): String)))
136 26357 5281 - 5366 Block scala.util.Left.apply scala.`package`.Left.apply[scalaoauth2.provider.UnauthorizedClient, Nothing](new scalaoauth2.provider.UnauthorizedClient(("Grant type ".+(grantType).+(" is not allowed for this client"): String)))
147 26656 5607 - 5624 Select scalaoauth2.provider.AuthorizationRequest.grantType org.make.api.technical.auth.makedatahandlercomponenttest request.grantType
147 26291 5634 - 5634 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
147 23961 5579 - 5778 ApplyToImplicitArgs scala.concurrent.Future.flatMap org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandler.this.findClient(maybeCredential, request.grantType).flatMap[Option[org.make.core.auth.UserRights]](((x0$1: Either[scalaoauth2.provider.OAuthError,org.make.core.auth.Client]) => x0$1 match { case (value: org.make.core.auth.Client): scala.util.Right[scalaoauth2.provider.OAuthError,org.make.core.auth.Client]((client @ _)) => DefaultMakeDataHandler.this.findUser(client, request).map[Option[org.make.core.auth.UserRights]](((x$2: Option[org.make.core.user.User]) => x$2.map[org.make.core.auth.UserRights](((user: org.make.core.user.User) => org.make.core.auth.UserRights.fromUser(user)))))(scala.concurrent.ExecutionContext.Implicits.global) case (value: scalaoauth2.provider.OAuthError): scala.util.Left[scalaoauth2.provider.OAuthError,org.make.core.auth.Client]((e @ _)) => scala.concurrent.Future.failed[Nothing](e) }))(scala.concurrent.ExecutionContext.Implicits.global)
148 28066 5696 - 5722 Apply scala.Option.map x$2.map[org.make.core.auth.UserRights](((user: org.make.core.user.User) => org.make.core.auth.UserRights.fromUser(user)))
148 24396 5702 - 5721 Apply org.make.core.auth.UserRights.fromUser org.make.core.auth.UserRights.fromUser(user)
148 25834 5695 - 5695 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
148 23426 5666 - 5723 ApplyToImplicitArgs scala.concurrent.Future.map DefaultMakeDataHandler.this.findUser(client, request).map[Option[org.make.core.auth.UserRights]](((x$2: Option[org.make.core.user.User]) => x$2.map[org.make.core.auth.UserRights](((user: org.make.core.user.User) => org.make.core.auth.UserRights.fromUser(user)))))(scala.concurrent.ExecutionContext.Implicits.global)
149 22519 5754 - 5770 Apply scala.concurrent.Future.failed scala.concurrent.Future.failed[Nothing](e)
154 27685 5909 - 5950 Apply org.make.api.technical.auth.OauthTokenGenerator.generateAccessToken org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandlerComponent.this.oauthTokenGenerator.generateAccessToken()
155 26588 5983 - 6025 Apply org.make.api.technical.auth.OauthTokenGenerator.generateRefreshToken org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandlerComponent.this.oauthTokenGenerator.generateRefreshToken()
157 24404 6084 - 6127 Select org.make.api.extensions.MakeSettings.Authentication.defaultClientId org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandlerComponent.this.makeSettings.Authentication.defaultClientId
157 27993 6056 - 6128 Apply scala.Option.getOrElse org.make.api.technical.auth.makedatahandlercomponenttest authInfo.clientId.getOrElse[String](DefaultMakeDataHandlerComponent.this.makeSettings.Authentication.defaultClientId)
159 25843 6179 - 6197 Apply org.make.core.auth.ClientId.apply org.make.api.technical.auth.makedatahandlercomponenttest org.make.core.auth.ClientId.apply(clientId)
159 23480 6155 - 6198 Apply org.make.api.technical.auth.ClientService.getClient org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandlerComponent.this.clientService.getClient(org.make.core.auth.ClientId.apply(clientId))
161 25997 6271 - 6271 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
161 23718 6239 - 7058 ApplyToImplicitArgs scala.concurrent.Future.flatMap org.make.api.technical.auth.makedatahandlercomponenttest futureAccessTokens.withFilter(((check$ifrefutable$1: (String, String)) => (check$ifrefutable$1: (String, String) @unchecked) match { case (_1: String, _2: String): (String, String)((accessToken @ _), _) => true case _ => false }))(scala.concurrent.ExecutionContext.Implicits.global).flatMap[org.make.core.auth.Token](((x$4: (String, String)) => (x$4: (String, String) @unchecked) match { case (_1: String, _2: String): (String, String)((accessToken @ _), _) => futureRefreshTokens.withFilter(((check$ifrefutable$2: (String, String)) => (check$ifrefutable$2: (String, String) @unchecked) match { case (_1: String, _2: String): (String, String)((refreshToken @ _), _) => true case _ => false }))(scala.concurrent.ExecutionContext.Implicits.global).flatMap[org.make.core.auth.Token](((x$3: (String, String)) => (x$3: (String, String) @unchecked) match { case (_1: String, _2: String): (String, String)((refreshToken @ _), _) => futureClient.flatMap[org.make.core.auth.Token](((maybeClient: Option[org.make.core.auth.Client]) => maybeClient.fold[scala.concurrent.Future[org.make.core.auth.Client]](scala.concurrent.Future.failed[org.make.core.auth.Client](new scalaoauth2.provider.InvalidClient(("Client with id ".+(clientId).+(" not found"): String))))(((result: org.make.core.auth.Client) => scala.concurrent.Future.successful[org.make.core.auth.Client](result))).map[org.make.core.auth.Token](((client: org.make.core.auth.Client) => { val maybeRefreshToken: Option[String] = if (client.allowedGrantTypes.contains[String](scalaoauth2.provider.OAuthGrantType.`package`.REFRESH_TOKEN)) scala.Some.apply[String](refreshToken) else scala.None; org.make.core.auth.Token.apply(accessToken, maybeRefreshToken, scala.None, client.tokenExpirationSeconds, client.refreshExpirationSeconds, authInfo.user, client, org.make.core.auth.Token.apply$default$8, org.make.core.auth.Token.apply$default$9) }))(scala.concurrent.ExecutionContext.Implicits.global)))(scala.concurrent.ExecutionContext.Implicits.global) }))(scala.concurrent.ExecutionContext.Implicits.global) }))(scala.concurrent.ExecutionContext.Implicits.global)
161 22443 6274 - 6274 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
162 26143 6322 - 6322 Literal <nosymbol> true
162 28151 6301 - 7058 ApplyToImplicitArgs scala.concurrent.Future.flatMap futureRefreshTokens.withFilter(((check$ifrefutable$2: (String, String)) => (check$ifrefutable$2: (String, String) @unchecked) match { case (_1: String, _2: String): (String, String)((refreshToken @ _), _) => true case _ => false }))(scala.concurrent.ExecutionContext.Implicits.global).flatMap[org.make.core.auth.Token](((x$3: (String, String)) => (x$3: (String, String) @unchecked) match { case (_1: String, _2: String): (String, String)((refreshToken @ _), _) => futureClient.flatMap[org.make.core.auth.Token](((maybeClient: Option[org.make.core.auth.Client]) => maybeClient.fold[scala.concurrent.Future[org.make.core.auth.Client]](scala.concurrent.Future.failed[org.make.core.auth.Client](new scalaoauth2.provider.InvalidClient(("Client with id ".+(clientId).+(" not found"): String))))(((result: org.make.core.auth.Client) => scala.concurrent.Future.successful[org.make.core.auth.Client](result))).map[org.make.core.auth.Token](((client: org.make.core.auth.Client) => { val maybeRefreshToken: Option[String] = if (client.allowedGrantTypes.contains[String](scalaoauth2.provider.OAuthGrantType.`package`.REFRESH_TOKEN)) scala.Some.apply[String](refreshToken) else scala.None; org.make.core.auth.Token.apply(accessToken, maybeRefreshToken, scala.None, client.tokenExpirationSeconds, client.refreshExpirationSeconds, authInfo.user, client, org.make.core.auth.Token.apply$default$8, org.make.core.auth.Token.apply$default$9) }))(scala.concurrent.ExecutionContext.Implicits.global)))(scala.concurrent.ExecutionContext.Implicits.global) }))(scala.concurrent.ExecutionContext.Implicits.global)
162 24314 6319 - 6319 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
162 23886 6322 - 6322 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
163 27842 6368 - 6368 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
163 25310 6350 - 7058 ApplyToImplicitArgs scala.concurrent.Future.flatMap futureClient.flatMap[org.make.core.auth.Token](((maybeClient: Option[org.make.core.auth.Client]) => maybeClient.fold[scala.concurrent.Future[org.make.core.auth.Client]](scala.concurrent.Future.failed[org.make.core.auth.Client](new scalaoauth2.provider.InvalidClient(("Client with id ".+(clientId).+(" not found"): String))))(((result: org.make.core.auth.Client) => scala.concurrent.Future.successful[org.make.core.auth.Client](result))).map[org.make.core.auth.Token](((client: org.make.core.auth.Client) => { val maybeRefreshToken: Option[String] = if (client.allowedGrantTypes.contains[String](scalaoauth2.provider.OAuthGrantType.`package`.REFRESH_TOKEN)) scala.Some.apply[String](refreshToken) else scala.None; org.make.core.auth.Token.apply(accessToken, maybeRefreshToken, scala.None, client.tokenExpirationSeconds, client.refreshExpirationSeconds, authInfo.user, client, org.make.core.auth.Token.apply$default$8, org.make.core.auth.Token.apply$default$9) }))(scala.concurrent.ExecutionContext.Implicits.global)))(scala.concurrent.ExecutionContext.Implicits.global)
164 26433 6419 - 6498 Apply scala.concurrent.Future.failed scala.concurrent.Future.failed[org.make.core.auth.Client](new scalaoauth2.provider.InvalidClient(("Client with id ".+(clientId).+(" not found"): String)))
164 27692 6441 - 6497 Apply scalaoauth2.provider.InvalidClient.<init> new scalaoauth2.provider.InvalidClient(("Client with id ".+(clientId).+(" not found"): String))
164 23905 6392 - 7058 ApplyToImplicitArgs scala.concurrent.Future.map maybeClient.fold[scala.concurrent.Future[org.make.core.auth.Client]](scala.concurrent.Future.failed[org.make.core.auth.Client](new scalaoauth2.provider.InvalidClient(("Client with id ".+(clientId).+(" not found"): String))))(((result: org.make.core.auth.Client) => scala.concurrent.Future.successful[org.make.core.auth.Client](result))).map[org.make.core.auth.Token](((client: org.make.core.auth.Client) => { val maybeRefreshToken: Option[String] = if (client.allowedGrantTypes.contains[String](scalaoauth2.provider.OAuthGrantType.`package`.REFRESH_TOKEN)) scala.Some.apply[String](refreshToken) else scala.None; org.make.core.auth.Token.apply(accessToken, maybeRefreshToken, scala.None, client.tokenExpirationSeconds, client.refreshExpirationSeconds, authInfo.user, client, org.make.core.auth.Token.apply$default$8, org.make.core.auth.Token.apply$default$9) }))(scala.concurrent.ExecutionContext.Implicits.global)
164 26287 6399 - 6399 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
165 24328 6511 - 6528 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[org.make.core.auth.Client](result)
169 25774 6601 - 6664 Apply scala.collection.SeqOps.contains client.allowedGrantTypes.contains[String](scalaoauth2.provider.OAuthGrantType.`package`.REFRESH_TOKEN)
169 28001 6635 - 6663 Select scalaoauth2.provider.OAuthGrantType.REFRESH_TOKEN scalaoauth2.provider.OAuthGrantType.`package`.REFRESH_TOKEN
170 23413 6680 - 6698 Apply scala.Some.apply scala.Some.apply[String](refreshToken)
170 22286 6680 - 6698 Block scala.Some.apply scala.Some.apply[String](refreshToken)
172 26070 6730 - 6734 Select scala.None scala.None
172 23893 6730 - 6734 Block scala.None scala.None
175 23422 6756 - 6756 Select org.make.core.auth.Token.apply$default$9 org.make.core.auth.Token.apply$default$9
175 22596 6756 - 7050 Apply org.make.core.auth.Token.apply org.make.core.auth.Token.apply(accessToken, maybeRefreshToken, scala.None, client.tokenExpirationSeconds, client.refreshExpirationSeconds, authInfo.user, client, org.make.core.auth.Token.apply$default$8, org.make.core.auth.Token.apply$default$9)
175 25782 6756 - 6756 Select org.make.core.auth.Token.apply$default$8 org.make.core.auth.Token.apply$default$8
178 27548 6862 - 6866 Select scala.None scala.None
179 25301 6890 - 6919 Select org.make.core.auth.Client.tokenExpirationSeconds client.tokenExpirationSeconds
180 24391 6950 - 6981 Select org.make.core.auth.Client.refreshExpirationSeconds client.refreshExpirationSeconds
181 27929 7000 - 7013 Select scalaoauth2.provider.AuthInfo.user authInfo.user
187 26212 7095 - 7095 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
187 22611 7096 - 7126 Apply org.make.api.technical.auth.PersistentTokenService.persist eta$0$1.persist(token)
188 25611 7066 - 7155 ApplyToImplicitArgs scala.concurrent.Future.map org.make.api.technical.auth.makedatahandlercomponenttest futureResult.flatMap[org.make.core.auth.Token]({ <synthetic> val eta$0$1: org.make.api.technical.auth.PersistentTokenService = DefaultMakeDataHandlerComponent.this.persistentTokenService; ((token: org.make.core.auth.Token) => eta$0$1.persist(token)) })(scala.concurrent.ExecutionContext.Implicits.global).map[scalaoauth2.provider.AccessToken](((token: org.make.core.auth.Token) => DefaultMakeDataHandler.this.toAccessToken(token)))(scala.concurrent.ExecutionContext.Implicits.global)
188 24037 7141 - 7154 Apply org.make.api.technical.auth.DefaultMakeDataHandlerComponent.DefaultMakeDataHandler.toAccessToken DefaultMakeDataHandler.this.toAccessToken(token)
188 27853 7140 - 7140 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
194 28160 7406 - 7429 Apply scala.concurrent.Future.successful org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.Future.successful[None.type](scala.None)
194 24323 7424 - 7428 Select scala.None org.make.api.technical.auth.makedatahandlercomponenttest scala.None
199 26226 7698 - 7698 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
199 23889 7634 - 7845 ApplyToImplicitArgs scala.concurrent.Future.flatMap org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandlerComponent.this.persistentTokenService.findByRefreshToken(refreshToken).flatMap[org.make.core.auth.Token](((x0$1: Option[org.make.core.auth.Token]) => x0$1 match { case (value: org.make.core.auth.Token): Some[org.make.core.auth.Token]((token @ _)) => scala.concurrent.Future.successful[org.make.core.auth.Token](token) case scala.None => scala.concurrent.Future.failed[Nothing](TokenAlreadyRefreshed.apply(refreshToken)) }))(scala.concurrent.ExecutionContext.Implicits.global)
200 25769 7730 - 7754 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[org.make.core.auth.Token](token)
201 23732 7799 - 7834 Apply org.make.api.technical.auth.TokenAlreadyRefreshed.apply TokenAlreadyRefreshed.apply(refreshToken)
201 27310 7785 - 7835 Apply scala.concurrent.Future.failed scala.concurrent.Future.failed[Nothing](TokenAlreadyRefreshed.apply(refreshToken))
205 23490 7879 - 7879 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
205 27325 7853 - 8082 ApplyToImplicitArgs scala.concurrent.Future.flatMap org.make.api.technical.auth.makedatahandlercomponenttest findByRefreshTokenOrFail(refreshToken).flatMap[scalaoauth2.provider.AccessToken](((token: org.make.core.auth.Token) => DefaultMakeDataHandlerComponent.this.persistentTokenService.deleteByAccessToken(token.accessToken).flatMap[scalaoauth2.provider.AccessToken](((x$5: Int) => (x$5: Int @unchecked) match { case _ => DefaultMakeDataHandler.this.createAccessToken(authInfo).map[scalaoauth2.provider.AccessToken](((accessToken: scalaoauth2.provider.AccessToken) => accessToken))(scala.concurrent.ExecutionContext.Implicits.global) }))(scala.concurrent.ExecutionContext.Implicits.global)))(scala.concurrent.ExecutionContext.Implicits.global)
206 25778 7929 - 8082 ApplyToImplicitArgs scala.concurrent.Future.flatMap DefaultMakeDataHandlerComponent.this.persistentTokenService.deleteByAccessToken(token.accessToken).flatMap[scalaoauth2.provider.AccessToken](((x$5: Int) => (x$5: Int @unchecked) match { case _ => DefaultMakeDataHandler.this.createAccessToken(authInfo).map[scalaoauth2.provider.AccessToken](((accessToken: scalaoauth2.provider.AccessToken) => accessToken))(scala.concurrent.ExecutionContext.Implicits.global) }))(scala.concurrent.ExecutionContext.Implicits.global)
206 27623 7987 - 8004 Select org.make.core.auth.Token.accessToken token.accessToken
206 28091 7941 - 7941 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
207 25622 8026 - 8026 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
207 24336 8014 - 8082 ApplyToImplicitArgs scala.concurrent.Future.map DefaultMakeDataHandler.this.createAccessToken(authInfo).map[scalaoauth2.provider.AccessToken](((accessToken: scalaoauth2.provider.AccessToken) => accessToken))(scala.concurrent.ExecutionContext.Implicits.global)
212 28009 8188 - 9326 ApplyToImplicitArgs scala.concurrent.Future.flatMap DefaultMakeDataHandlerComponent.this.persistentAuthCodeService.findByCode(code).flatMap[Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](((x0$1: Option[org.make.core.auth.AuthCode]) => x0$1 match { case scala.None => scala.concurrent.Future.successful[None.type](scala.None) case (value: org.make.core.auth.AuthCode): Some[org.make.core.auth.AuthCode]((authCode @ _)) => DefaultMakeDataHandlerComponent.this.clientService.getClient(authCode.client).flatMap[Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](((x0$2: Option[org.make.core.auth.Client]) => x0$2 match { case (value: org.make.core.auth.Client): Some[org.make.core.auth.Client]((client @ _)) => DefaultMakeDataHandlerComponent.this.persistentUserService.get(authCode.user).flatMap[Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](((x0$3: Option[org.make.core.user.User]) => x0$3 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if DefaultMakeDataHandler.this.userIsRelatedToClient(client)(user) => scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](org.make.core.auth.UserRights.apply(user.userId, user.roles, user.availableQuestions, user.emailVerified, org.make.core.auth.UserRights.apply$default$5), scala.Some.apply[String](authCode.client.value), authCode.scope, authCode.redirectUri, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]))) case scala.None => scala.concurrent.Future.successful[None.type](scala.None) case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) => scala.concurrent.Future.failed[Nothing](new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client))) }))(scala.concurrent.ExecutionContext.Implicits.global) case _ => scala.concurrent.Future.successful[None.type](scala.None) }))(scala.concurrent.ExecutionContext.Implicits.global) }))(scala.concurrent.ExecutionContext.Implicits.global)
212 23207 8239 - 8239 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
213 23814 8262 - 8285 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
213 26236 8280 - 8284 Select scala.None scala.None
215 27791 8376 - 8376 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
215 25541 8327 - 9318 ApplyToImplicitArgs scala.concurrent.Future.flatMap DefaultMakeDataHandlerComponent.this.clientService.getClient(authCode.client).flatMap[Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](((x0$2: Option[org.make.core.auth.Client]) => x0$2 match { case (value: org.make.core.auth.Client): Some[org.make.core.auth.Client]((client @ _)) => DefaultMakeDataHandlerComponent.this.persistentUserService.get(authCode.user).flatMap[Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](((x0$3: Option[org.make.core.user.User]) => x0$3 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if DefaultMakeDataHandler.this.userIsRelatedToClient(client)(user) => scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](org.make.core.auth.UserRights.apply(user.userId, user.roles, user.availableQuestions, user.emailVerified, org.make.core.auth.UserRights.apply$default$5), scala.Some.apply[String](authCode.client.value), authCode.scope, authCode.redirectUri, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]))) case scala.None => scala.concurrent.Future.successful[None.type](scala.None) case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) => scala.concurrent.Future.failed[Nothing](new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client))) }))(scala.concurrent.ExecutionContext.Implicits.global) case _ => scala.concurrent.Future.successful[None.type](scala.None) }))(scala.concurrent.ExecutionContext.Implicits.global)
215 27631 8351 - 8366 Select org.make.core.auth.AuthCode.client authCode.client
218 25598 8468 - 8481 Select org.make.core.auth.AuthCode.user authCode.user
219 23654 8508 - 8508 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
219 27485 8425 - 9260 ApplyToImplicitArgs scala.concurrent.Future.flatMap DefaultMakeDataHandlerComponent.this.persistentUserService.get(authCode.user).flatMap[Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](((x0$3: Option[org.make.core.user.User]) => x0$3 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if DefaultMakeDataHandler.this.userIsRelatedToClient(client)(user) => scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](org.make.core.auth.UserRights.apply(user.userId, user.roles, user.availableQuestions, user.emailVerified, org.make.core.auth.UserRights.apply$default$5), scala.Some.apply[String](authCode.client.value), authCode.scope, authCode.redirectUri, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]))) case scala.None => scala.concurrent.Future.successful[None.type](scala.None) case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) => scala.concurrent.Future.failed[Nothing](new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client))) }))(scala.concurrent.ExecutionContext.Implicits.global)
220 23212 8547 - 8582 Apply org.make.api.technical.auth.DefaultMakeDataHandlerComponent.DefaultMakeDataHandler.userIsRelatedToClient DefaultMakeDataHandler.this.userIsRelatedToClient(client)(user)
221 24126 8606 - 9050 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](org.make.core.auth.UserRights.apply(user.userId, user.roles, user.availableQuestions, user.emailVerified, org.make.core.auth.UserRights.apply$default$5), scala.Some.apply[String](authCode.client.value), authCode.scope, authCode.redirectUri, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing])))
222 26222 8647 - 9028 Apply scala.Some.apply scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](org.make.core.auth.UserRights.apply(user.userId, user.roles, user.availableQuestions, user.emailVerified, org.make.core.auth.UserRights.apply$default$5), scala.Some.apply[String](authCode.client.value), authCode.scope, authCode.redirectUri, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]))
223 27477 8677 - 9004 Apply scalaoauth2.provider.AuthInfo.apply scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](org.make.core.auth.UserRights.apply(user.userId, user.roles, user.availableQuestions, user.emailVerified, org.make.core.auth.UserRights.apply$default$5), scala.Some.apply[String](authCode.client.value), authCode.scope, authCode.redirectUri, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing])
223 23646 8677 - 8677 TypeApply scalaoauth2.provider.AuthInfo.apply$default$6 scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]
223 25713 8677 - 8677 TypeApply scalaoauth2.provider.AuthInfo.apply$default$5 scalaoauth2.provider.AuthInfo.apply$default$5[Nothing]
224 23825 8720 - 8800 Apply org.make.core.auth.UserRights.apply org.make.core.auth.UserRights.apply(user.userId, user.roles, user.availableQuestions, user.emailVerified, org.make.core.auth.UserRights.apply$default$5)
224 27937 8731 - 8742 Select org.make.core.user.User.userId user.userId
224 25703 8744 - 8754 Select org.make.core.user.User.roles user.roles
224 27173 8781 - 8799 Select org.make.core.user.User.emailVerified user.emailVerified
224 26159 8720 - 8720 Select org.make.core.auth.UserRights.apply$default$5 org.make.core.auth.UserRights.apply$default$5
224 23497 8756 - 8779 Select org.make.core.user.User.availableQuestions user.availableQuestions
225 25608 8839 - 8866 Apply scala.Some.apply scala.Some.apply[String](authCode.client.value)
225 27563 8844 - 8865 Select org.make.core.auth.ClientId.value authCode.client.value
226 23040 8902 - 8916 Select org.make.core.auth.AuthCode.scope authCode.scope
227 28246 8958 - 8978 Select org.make.core.auth.AuthCode.redirectUri authCode.redirectUri
231 25617 9082 - 9105 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
231 27571 9100 - 9104 Select scala.None scala.None
233 28087 9177 - 9241 Apply scalaoauth2.provider.AccessDenied.<init> new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client))
233 23355 9194 - 9240 Apply org.make.api.technical.auth.MakeDataHandler.insufficientRole MakeDataHandler.insufficientRole(user, client)
233 26010 9163 - 9242 Apply scala.concurrent.Future.failed scala.concurrent.Future.failed[Nothing](new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client)))
235 23980 9283 - 9306 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
235 25082 9301 - 9305 Select scala.None scala.None
241 25863 9404 - 9448 Apply org.make.api.technical.auth.PersistentAuthCodeService.deleteByCode DefaultMakeDataHandlerComponent.this.persistentAuthCodeService.deleteByCode(code)
245 27567 9634 - 9634 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
245 25317 9570 - 10027 ApplyToImplicitArgs scala.concurrent.Future.flatMap org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandlerComponent.this.persistentTokenService.findByRefreshToken(refreshToken).flatMap[Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](((x0$1: Option[org.make.core.auth.Token]) => x0$1 match { case (value: org.make.core.auth.Token): Some[org.make.core.auth.Token]((token @ _)) if token.isRefreshTokenExpired.unary_! => scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](token.user, scala.Some.apply[String](token.client.clientId.value), token.scope, scala.None, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]))) case _ => scala.concurrent.Future.successful[None.type](scala.None) }))(scala.concurrent.ExecutionContext.Implicits.global)
246 23662 9664 - 9692 Select scala.Boolean.unary_! token.isRefreshTokenExpired.unary_!
247 27424 9706 - 9977 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](token.user, scala.Some.apply[String](token.client.clientId.value), token.scope, scala.None, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing])))
248 23432 9737 - 9965 Apply scala.Some.apply scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](token.user, scala.Some.apply[String](token.client.clientId.value), token.scope, scala.None, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]))
249 23128 9757 - 9757 TypeApply scalaoauth2.provider.AuthInfo.apply$default$5 scalaoauth2.provider.AuthInfo.apply$default$5[Nothing]
249 28023 9757 - 9757 TypeApply scalaoauth2.provider.AuthInfo.apply$default$6 scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]
249 25710 9757 - 9951 Apply scalaoauth2.provider.AuthInfo.apply scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](token.user, scala.Some.apply[String](token.client.clientId.value), token.scope, scala.None, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing])
250 27411 9790 - 9800 Select org.make.core.auth.Token.user token.user
251 23904 9829 - 9862 Apply scala.Some.apply scala.Some.apply[String](token.client.clientId.value)
251 25094 9834 - 9861 Select org.make.core.auth.ClientId.value token.client.clientId.value
252 27558 9888 - 9899 Select org.make.core.auth.Token.scope token.scope
253 25550 9931 - 9935 Select scala.None scala.None
257 23918 9996 - 10019 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
257 25013 10014 - 10018 Select scala.None scala.None
262 23141 10199 - 10216 Select scalaoauth2.provider.AccessToken.token org.make.api.technical.auth.makedatahandlercomponenttest accessToken.token
262 26898 10159 - 10217 Apply com.google.common.cache.Cache.getIfPresent org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandler.this.authInfoByAccessTokenCache.getIfPresent(accessToken.token)
263 23438 10244 - 10277 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](authInfo))
263 26006 10262 - 10276 Apply scala.Some.apply scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](authInfo)
264 23756 10152 - 10844 Apply scala.Option.getOrElse org.make.api.technical.auth.makedatahandlercomponenttest scala.Option.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](DefaultMakeDataHandler.this.authInfoByAccessTokenCache.getIfPresent(accessToken.token)).map[scala.concurrent.Future[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]]](((authInfo: scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]) => scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](authInfo)))).getOrElse[scala.concurrent.Future[Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]]](DefaultMakeDataHandlerComponent.this.persistentTokenService.get(accessToken.token).flatMap[Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](((x0$1: Option[org.make.core.auth.Token]) => x0$1 match { case (value: org.make.core.auth.Token): Some[org.make.core.auth.Token]((token @ _)) => { val authInfo: scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights] = scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](token.user, scala.Some.apply[String](token.client.clientId.value), token.scope, scala.None, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]); DefaultMakeDataHandler.this.authInfoByAccessTokenCache.put(accessToken.token, authInfo); scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](authInfo)) } case scala.None => scala.concurrent.Future.successful[None.type](scala.None) }))(scala.concurrent.ExecutionContext.Implicits.global))
265 26972 10394 - 10394 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
265 25948 10310 - 10834 ApplyToImplicitArgs scala.concurrent.Future.flatMap org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandlerComponent.this.persistentTokenService.get(accessToken.token).flatMap[Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](((x0$1: Option[org.make.core.auth.Token]) => x0$1 match { case (value: org.make.core.auth.Token): Some[org.make.core.auth.Token]((token @ _)) => { val authInfo: scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights] = scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](token.user, scala.Some.apply[String](token.client.clientId.value), token.scope, scala.None, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]); DefaultMakeDataHandler.this.authInfoByAccessTokenCache.put(accessToken.token, authInfo); scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](authInfo)) } case scala.None => scala.concurrent.Future.successful[None.type](scala.None) }))(scala.concurrent.ExecutionContext.Implicits.global)
265 27400 10337 - 10354 Select scalaoauth2.provider.AccessToken.token org.make.api.technical.auth.makedatahandlercomponenttest accessToken.token
267 23744 10457 - 10651 Apply scalaoauth2.provider.AuthInfo.apply scalaoauth2.provider.AuthInfo.apply[org.make.core.auth.UserRights](token.user, scala.Some.apply[String](token.client.clientId.value), token.scope, scala.None, scalaoauth2.provider.AuthInfo.apply$default$5[Nothing], scalaoauth2.provider.AuthInfo.apply$default$6[Nothing])
267 26014 10457 - 10457 TypeApply scalaoauth2.provider.AuthInfo.apply$default$6 scalaoauth2.provider.AuthInfo.apply$default$6[Nothing]
267 26911 10457 - 10457 TypeApply scalaoauth2.provider.AuthInfo.apply$default$5 scalaoauth2.provider.AuthInfo.apply$default$5[Nothing]
268 25026 10490 - 10500 Select org.make.core.auth.Token.user token.user
269 27863 10529 - 10562 Apply scala.Some.apply scala.Some.apply[String](token.client.clientId.value)
269 24131 10534 - 10561 Select org.make.core.auth.ClientId.value token.client.clientId.value
270 25326 10588 - 10599 Select org.make.core.auth.Token.scope token.scope
271 23288 10631 - 10635 Select scala.None scala.None
273 25246 10666 - 10725 Apply com.google.common.cache.Cache.put DefaultMakeDataHandler.this.authInfoByAccessTokenCache.put(accessToken.token, authInfo)
273 27408 10697 - 10714 Select scalaoauth2.provider.AccessToken.token accessToken.token
274 22995 10758 - 10772 Apply scala.Some.apply scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](authInfo)
274 27875 10740 - 10773 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]](scala.Some.apply[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]](authInfo))
275 25460 10817 - 10821 Select scala.None scala.None
275 23298 10799 - 10822 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
281 27335 10946 - 10982 Apply com.google.common.cache.Cache.getIfPresent org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandler.this.accessTokenCache.getIfPresent(token)
282 25181 11000 - 11023 Select scala.Boolean.unary_! x$6.isAccessTokenExpired.unary_!
283 27802 11047 - 11077 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[Some[org.make.core.auth.Token]](scala.Some.apply[org.make.core.auth.Token](token))
283 22842 11065 - 11076 Apply scala.Some.apply scala.Some.apply[org.make.core.auth.Token](token)
287 23305 11187 - 11220 Apply scala.Option.filter x$7.filter(((x$8: org.make.core.auth.Token) => x$8.isAccessTokenExpired.unary_!))
287 25801 11123 - 11221 ApplyToImplicitArgs scala.concurrent.Future.map org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandlerComponent.this.persistentTokenService.get(token).map[Option[org.make.core.auth.Token]](((x$7: Option[org.make.core.auth.Token]) => x$7.filter(((x$8: org.make.core.auth.Token) => x$8.isAccessTokenExpired.unary_!))))(scala.concurrent.ExecutionContext.Implicits.global)
287 25472 11196 - 11219 Select scala.Boolean.unary_! x$8.isAccessTokenExpired.unary_!
287 26895 11186 - 11186 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
288 25019 11250 - 11250 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
288 22770 11232 - 11392 ApplyToImplicitArgs scala.concurrent.Future.onComplete org.make.api.technical.auth.makedatahandlercomponenttest future.onComplete[Unit](((x0$1: scala.util.Try[Option[org.make.core.auth.Token]]) => x0$1 match { case (value: Option[org.make.core.auth.Token]): scala.util.Success[Option[org.make.core.auth.Token]]((value: org.make.core.auth.Token): Some[org.make.core.auth.Token]((userToken @ _))) => DefaultMakeDataHandler.this.accessTokenCache.put(token, userToken) case _ => () }))(scala.concurrent.ExecutionContext.Implicits.global)
289 23525 11297 - 11335 Apply com.google.common.cache.Cache.put DefaultMakeDataHandler.this.accessTokenCache.put(token, userToken)
290 27346 11378 - 11380 Literal <nosymbol> ()
294 25479 11433 - 11453 Apply scala.Option.map x$9.map[scalaoauth2.provider.AccessToken](((token: org.make.core.auth.Token) => DefaultMakeDataHandler.this.toAccessToken(token)))
294 27653 11439 - 11452 Apply org.make.api.technical.auth.DefaultMakeDataHandlerComponent.DefaultMakeDataHandler.toAccessToken DefaultMakeDataHandler.this.toAccessToken(token)
294 23232 11432 - 11432 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
294 26906 10939 - 11454 ApplyToImplicitArgs scala.concurrent.Future.map org.make.api.technical.auth.makedatahandlercomponenttest scala.Option.apply[org.make.core.auth.Token](DefaultMakeDataHandler.this.accessTokenCache.getIfPresent(token)).filter(((x$6: org.make.core.auth.Token) => x$6.isAccessTokenExpired.unary_!)).map[scala.concurrent.Future[Some[org.make.core.auth.Token]]](((token: org.make.core.auth.Token) => scala.concurrent.Future.successful[Some[org.make.core.auth.Token]](scala.Some.apply[org.make.core.auth.Token](token)))).getOrElse[scala.concurrent.Future[Option[org.make.core.auth.Token]]]({ val future: scala.concurrent.Future[Option[org.make.core.auth.Token]] = DefaultMakeDataHandlerComponent.this.persistentTokenService.get(token).map[Option[org.make.core.auth.Token]](((x$7: Option[org.make.core.auth.Token]) => x$7.filter(((x$8: org.make.core.auth.Token) => x$8.isAccessTokenExpired.unary_!))))(scala.concurrent.ExecutionContext.Implicits.global); future.onComplete[Unit](((x0$1: scala.util.Try[Option[org.make.core.auth.Token]]) => x0$1 match { case (value: Option[org.make.core.auth.Token]): scala.util.Success[Option[org.make.core.auth.Token]]((value: org.make.core.auth.Token): Some[org.make.core.auth.Token]((userToken @ _))) => DefaultMakeDataHandler.this.accessTokenCache.put(token, userToken) case _ => () }))(scala.concurrent.ExecutionContext.Implicits.global); future }).map[Option[scalaoauth2.provider.AccessToken]](((x$9: Option[org.make.core.auth.Token]) => x$9.map[scalaoauth2.provider.AccessToken](((token: org.make.core.auth.Token) => DefaultMakeDataHandler.this.toAccessToken(token)))))(scala.concurrent.ExecutionContext.Implicits.global)
298 24651 11538 - 11583 Apply org.make.api.technical.auth.PersistentTokenService.deleteByUserId DefaultMakeDataHandlerComponent.this.persistentTokenService.deleteByUserId(userId)
308 23672 11787 - 12714 ApplyToImplicitArgs scala.concurrent.Future.flatMap DefaultMakeDataHandlerComponent.this.clientService.getClient(clientId).flatMap[Option[org.make.core.auth.AuthCode]](((x0$1: Option[org.make.core.auth.Client]) => x0$1 match { case scala.None => scala.concurrent.Future.successful[None.type](scala.None) case (value: org.make.core.auth.Client): Some[org.make.core.auth.Client]((client @ _)) => DefaultMakeDataHandlerComponent.this.persistentUserService.get(userId).flatMap[Option[org.make.core.auth.AuthCode]](((x0$2: Option[org.make.core.user.User]) => x0$2 match { case scala.None => scala.concurrent.Future.successful[None.type](scala.None) case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if DefaultMakeDataHandler.this.userIsRelatedToClient(client)(user) => DefaultMakeDataHandlerComponent.this.persistentAuthCodeService.persist(org.make.core.auth.AuthCode.apply(DefaultMakeDataHandlerComponent.this.idGenerator.nextId(), scope, redirectUri, org.make.core.DateHelper.now(), client.tokenExpirationSeconds, userId, clientId)).map[Some[org.make.core.auth.AuthCode]](((x$10: org.make.core.auth.AuthCode) => scala.Some.apply[org.make.core.auth.AuthCode](x$10)))(scala.concurrent.ExecutionContext.Implicits.global) case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) => scala.concurrent.Future.failed[Nothing](new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client))) }))(scala.concurrent.ExecutionContext.Implicits.global) }))(scala.concurrent.ExecutionContext.Implicits.global)
308 24798 11829 - 11829 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
309 23740 11870 - 11874 Select scala.None scala.None
309 27355 11852 - 11875 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
311 26845 11915 - 12706 ApplyToImplicitArgs scala.concurrent.Future.flatMap DefaultMakeDataHandlerComponent.this.persistentUserService.get(userId).flatMap[Option[org.make.core.auth.AuthCode]](((x0$2: Option[org.make.core.user.User]) => x0$2 match { case scala.None => scala.concurrent.Future.successful[None.type](scala.None) case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if DefaultMakeDataHandler.this.userIsRelatedToClient(client)(user) => DefaultMakeDataHandlerComponent.this.persistentAuthCodeService.persist(org.make.core.auth.AuthCode.apply(DefaultMakeDataHandlerComponent.this.idGenerator.nextId(), scope, redirectUri, org.make.core.DateHelper.now(), client.tokenExpirationSeconds, userId, clientId)).map[Some[org.make.core.auth.AuthCode]](((x$10: org.make.core.auth.AuthCode) => scala.Some.apply[org.make.core.auth.AuthCode](x$10)))(scala.concurrent.ExecutionContext.Implicits.global) case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) => scala.concurrent.Future.failed[Nothing](new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client))) }))(scala.concurrent.ExecutionContext.Implicits.global)
311 23220 11957 - 11957 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
312 22782 11984 - 12007 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
312 24951 12002 - 12006 Select scala.None scala.None
313 27790 12039 - 12074 Apply org.make.api.technical.auth.DefaultMakeDataHandlerComponent.DefaultMakeDataHandler.userIsRelatedToClient DefaultMakeDataHandler.this.userIsRelatedToClient(client)(user)
316 24660 12162 - 12521 Apply org.make.core.auth.AuthCode.apply org.make.core.auth.AuthCode.apply(DefaultMakeDataHandlerComponent.this.idGenerator.nextId(), scope, redirectUri, org.make.core.DateHelper.now(), client.tokenExpirationSeconds, userId, clientId)
317 25629 12212 - 12232 Apply org.make.core.technical.IdGenerator.nextId DefaultMakeDataHandlerComponent.this.idGenerator.nextId()
320 23241 12348 - 12364 Apply org.make.core.DefaultDateHelper.now org.make.core.DateHelper.now()
321 26834 12398 - 12427 Select org.make.core.auth.Client.tokenExpirationSeconds client.tokenExpirationSeconds
326 23753 12561 - 12568 Apply scala.Some.apply scala.Some.apply[org.make.core.auth.AuthCode](x$10)
326 24960 12092 - 12569 ApplyToImplicitArgs scala.concurrent.Future.map DefaultMakeDataHandlerComponent.this.persistentAuthCodeService.persist(org.make.core.auth.AuthCode.apply(DefaultMakeDataHandlerComponent.this.idGenerator.nextId(), scope, redirectUri, org.make.core.DateHelper.now(), client.tokenExpirationSeconds, userId, clientId)).map[Some[org.make.core.auth.AuthCode]](((x$10: org.make.core.auth.AuthCode) => scala.Some.apply[org.make.core.auth.AuthCode](x$10)))(scala.concurrent.ExecutionContext.Implicits.global)
326 27493 12560 - 12560 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
328 25640 12615 - 12694 Apply scala.concurrent.Future.failed scala.concurrent.Future.failed[Nothing](new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client)))
328 22706 12646 - 12692 Apply org.make.api.technical.auth.MakeDataHandler.insufficientRole MakeDataHandler.insufficientRole(user, client)
328 27798 12629 - 12693 Apply scalaoauth2.provider.AccessDenied.<init> new scalaoauth2.provider.AccessDenied(MakeDataHandler.insufficientRole(user, client))
334 27502 12823 - 12864 Apply com.google.common.cache.Cache.getIfPresent org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandler.this.accessTokenCache.getIfPresent(tokenValue)
335 22715 12888 - 12918 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[Some[org.make.core.auth.Token]](scala.Some.apply[org.make.core.auth.Token](token))
335 25104 12906 - 12917 Apply scala.Some.apply scala.Some.apply[org.make.core.auth.Token](token)
337 26766 12951 - 12989 Apply org.make.api.technical.auth.PersistentTokenService.get org.make.api.technical.auth.makedatahandlercomponenttest DefaultMakeDataHandlerComponent.this.persistentTokenService.get(tokenValue)
339 22556 13017 - 13017 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.technical.auth.makedatahandlercomponenttest scala.concurrent.ExecutionContext.Implicits.global
339 27281 12816 - 13551 ApplyToImplicitArgs scala.concurrent.Future.flatMap org.make.api.technical.auth.makedatahandlercomponenttest scala.Option.apply[org.make.core.auth.Token](DefaultMakeDataHandler.this.accessTokenCache.getIfPresent(tokenValue)).map[scala.concurrent.Future[Some[org.make.core.auth.Token]]](((token: org.make.core.auth.Token) => scala.concurrent.Future.successful[Some[org.make.core.auth.Token]](scala.Some.apply[org.make.core.auth.Token](token)))).getOrElse[scala.concurrent.Future[Option[org.make.core.auth.Token]]](DefaultMakeDataHandlerComponent.this.persistentTokenService.get(tokenValue)).flatMap[Option[org.make.core.auth.Token]](((x0$1: Option[org.make.core.auth.Token]) => x0$1 match { case (value: org.make.core.auth.Token): Some[org.make.core.auth.Token]((token @ (accessToken: String, refreshToken: Option[String], scope: Option[String], expiresIn: Int, refreshExpiresIn: Int, user: org.make.core.auth.UserRights, client: org.make.core.auth.Client, createdAt: Option[java.time.ZonedDateTime], updatedAt: Option[java.time.ZonedDateTime]): org.make.core.auth.Token(_, (value: String): Some[String]((refreshToken @ _)), _, _, _, _, _, _, _))) if token.isAccessTokenExpired.&&(token.isRefreshTokenExpired.unary_!) => DefaultMakeDataHandler.this.findAuthInfoByAccessToken(DefaultMakeDataHandler.this.toAccessToken(token)).flatMap[Option[org.make.core.auth.Token]](((x0$2: Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]) => x0$2 match { case (value: scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]): Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]((authInfo @ _)) => DefaultMakeDataHandler.this.refreshAccessToken(authInfo, refreshToken).flatMap[Option[org.make.core.auth.Token]](((token: scalaoauth2.provider.AccessToken) => DefaultMakeDataHandlerComponent.this.persistentTokenService.get(token.token)))(scala.concurrent.ExecutionContext.Implicits.global) case _ => scala.concurrent.Future.successful[None.type](scala.None) }))(scala.concurrent.ExecutionContext.Implicits.global) case _ => scala.concurrent.Future.successful[None.type](scala.None) }))(scala.concurrent.ExecutionContext.Implicits.global)
341 23229 13115 - 13189 Apply scala.Boolean.&& token.isAccessTokenExpired.&&(token.isRefreshTokenExpired.unary_!)
342 25561 13161 - 13189 Select scala.Boolean.unary_! token.isRefreshTokenExpired.unary_!
343 26981 13231 - 13251 Apply org.make.api.technical.auth.DefaultMakeDataHandlerComponent.DefaultMakeDataHandler.toAccessToken DefaultMakeDataHandler.this.toAccessToken(token)
343 23150 13205 - 13497 ApplyToImplicitArgs scala.concurrent.Future.flatMap DefaultMakeDataHandler.this.findAuthInfoByAccessToken(DefaultMakeDataHandler.this.toAccessToken(token)).flatMap[Option[org.make.core.auth.Token]](((x0$2: Option[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]) => x0$2 match { case (value: scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]): Some[scalaoauth2.provider.AuthInfo[org.make.core.auth.UserRights]]((authInfo @ _)) => DefaultMakeDataHandler.this.refreshAccessToken(authInfo, refreshToken).flatMap[Option[org.make.core.auth.Token]](((token: scalaoauth2.provider.AccessToken) => DefaultMakeDataHandlerComponent.this.persistentTokenService.get(token.token)))(scala.concurrent.ExecutionContext.Implicits.global) case _ => scala.concurrent.Future.successful[None.type](scala.None) }))(scala.concurrent.ExecutionContext.Implicits.global)
343 25575 13261 - 13261 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
346 24809 13422 - 13433 Select scalaoauth2.provider.AccessToken.token token.token
346 27273 13385 - 13385 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
346 23684 13395 - 13434 Apply org.make.api.technical.auth.PersistentTokenService.get DefaultMakeDataHandlerComponent.this.persistentTokenService.get(token.token)
346 25115 13316 - 13435 ApplyToImplicitArgs scala.concurrent.Future.flatMap DefaultMakeDataHandler.this.refreshAccessToken(authInfo, refreshToken).flatMap[Option[org.make.core.auth.Token]](((token: scalaoauth2.provider.AccessToken) => DefaultMakeDataHandlerComponent.this.persistentTokenService.get(token.token)))(scala.concurrent.ExecutionContext.Implicits.global)
347 22777 13478 - 13482 Select scala.None scala.None
347 26691 13460 - 13483 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
349 24656 13518 - 13541 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[None.type](scala.None)
349 26988 13536 - 13540 Select scala.None scala.None
354 22703 13680 - 13680 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
354 25038 13686 - 13720 Apply com.google.common.cache.Cache.invalidate DefaultMakeDataHandler.this.accessTokenCache.invalidate(token)
354 26533 13627 - 13721 ApplyToImplicitArgs scala.concurrent.Future.map DefaultMakeDataHandlerComponent.this.persistentTokenService.deleteByAccessToken(token).map[Unit](((x$11: Int) => DefaultMakeDataHandler.this.accessTokenCache.invalidate(token)))(scala.concurrent.ExecutionContext.Implicits.global)