score:0

Accepted answer

Here is my solution... I've just modified the configuration like this...

auth {
    securityProfiles = [
        {
            operation = "myOperation1"
            roles = ["author", "auditor"]
        }
        {
            operation = "myOperation2"
            roles = ["admin"]
        }
        {
            operation = "myOperationN"
            roles = ["auditor", "default"]
        }
    ]
}

... and then read it with the following code snipper:

import scala.collection.mutable.Map

var securityProfiles = Map[String, List[String]]().withDefaultValue(List.empty)
  configuration.getConfigList("auth.securityProfiles").map { _.toList.map { config =>
    config.getString("operation").map { op =>
      securityProfiles += (op -> config.getStringList("roles").map(_.toList).getOrElse(List.empty))
  }
}}

I hope that helps.


Related Query

More Query from same tag