Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Qi77Qi committed Aug 22, 2018
1 parent 62a3d10 commit a4eac7d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.broadinstitute.dsde.workbench.sam.api

import akka.http.scaladsl.model.headers.OAuth2BearerToken
import akka.http.scaladsl.server._
import akka.http.scaladsl.server.Directives.{headerValueByName, onSuccess}
import akka.http.scaladsl.server.Directives.{headerValueByName, optionalHeaderValueByName, onSuccess}
import org.broadinstitute.dsde.workbench.model._
import akka.http.scaladsl.server.Directives.headerValueByName
import org.broadinstitute.dsde.workbench.model.google.ServiceAccountSubjectId
Expand All @@ -24,10 +24,12 @@ trait StandardUserInfoDirectives extends UserInfoDirectives {
def requireUserInfo: Directive1[UserInfo] = (
headerValueByName("OIDC_access_token") &
headerValueByName("OIDC_CLAIM_user_id") &
optionalHeaderValueByName("OIDC_CLAIM_google_subject_id") &
headerValueByName("OIDC_CLAIM_expires_in") &
headerValueByName("OIDC_CLAIM_email")
) tflatMap {
case (token, userId, expiresIn, email) => {
case (token, userId, googleSubjectId, expiresIn, email) => {
println(s"11111: $googleSubjectId")
val userInfo = UserInfo(OAuth2BearerToken(token), WorkbenchUserId(userId), WorkbenchEmail(email), expiresIn.toLong)
onSuccess(getUserFromPetServiceAccount(userInfo).map {
case Some(petOwnerUser) => UserInfo(OAuth2BearerToken(token), petOwnerUser.id, petOwnerUser.email, expiresIn.toLong)
Expand Down

0 comments on commit a4eac7d

Please sign in to comment.