Permalink
Browse files

Add debug logging for authentication

  • Loading branch information...
ebruchez committed Feb 2, 2017
1 parent a683763 commit 1c43ab56ef65d0db95a73340a666d286a6f114af
Showing with 16 additions and 4 deletions.
  1. +16 −4 form-runner/src/main/scala/org/orbeon/oxf/fr/FormRunnerAuth.scala
@@ -117,11 +117,15 @@ object FormRunnerAuth {
val propertySet = properties
propertySet.getString(MethodPropertyName, "container") match {
case "container"
case authMethod @ "container"
Logger.debug(s"using `$authMethod` method")
val usernameOpt = Option(userRoles.getRemoteUser)
val rolesStringOpt = Option(propertySet.getString(ContainerRolesPropertyName))
Logger.debug(s"usernameOpt: `$usernameOpt`, roles: `$rolesStringOpt`")
rolesStringOpt match {
case None
None
@@ -157,7 +161,9 @@ object FormRunnerAuth {
}
}
case "header"
case authMethod @ "header"
Logger.debug(s"using `$authMethod` method")
val headerPropertyName =
propertySet.getString(HeaderRolesPropertyNamePropertyName).trimAllToOpt
@@ -168,6 +174,8 @@ object FormRunnerAuth {
val rolesSplit = propertySet.getString(HeaderRolesSplitPropertyName, """(\s*[,\|]\s*)+""")
def splitRoles(value: String) = value split rolesSplit
Logger.debug(s"using properties: $HeaderRolesPropertyNamePropertyName=`$headerPropertyName`, $HeaderRolesSplitPropertyName=`$rolesSplit`")
// If configured, a header can have the form `name=value` where `name` is specified in a property
def splitWithinRole(value: String) = headerPropertyName match {
case Some(propertyName)
@@ -178,10 +186,13 @@ object FormRunnerAuth {
case _ List(value)
}
import org.orbeon.oxf.util.CoreUtils._
// Credentials coming from the JSON-encoded HTTP header
def fromCredentialsHeader =
headerList(HeaderCredentialsPropertyName).headOption flatMap
(Credentials.parseCredentials(_, decodeForHeader = true))
(Credentials.parseCredentials(_, decodeForHeader = true)) kestrel
(_ Logger.debug(s"found from credential headers"))
// Credentials coming from individual headers (requires at least the username)
def fromIndividualHeaders =
@@ -198,7 +209,8 @@ object FormRunnerAuth {
group = headerList(HeaderGroupPropertyName).headOption,
organizations = Nil
)
}
} kestrel
(_ Logger.debug(s"found from individual headers"))
fromCredentialsHeader orElse fromIndividualHeaders

0 comments on commit 1c43ab5

Please sign in to comment.