rabbah commented on a change in pull request #2218: Port Controller from Spray 
to Akka
URL: 
https://github.com/apache/incubator-openwhisk/pull/2218#discussion_r132813919
 
 

 ##########
 File path: 
core/controller/src/main/scala/whisk/core/controller/AuthenticatedRoute.scala
 ##########
 @@ -38,19 +37,17 @@ trait AuthenticatedRoute {
     protected implicit val executionContext: ExecutionContext
 
     /** Creates HTTP BasicAuth handler */
-    protected def basicauth(implicit transid: TransactionId) = {
-        new BasicHttpAuthenticator[Identity](realm = "whisk rest service", 
validateCredentials _) {
-            override def apply(ctx: RequestContext) = {
-                super.apply(ctx) recover {
-                    case t: IllegalStateException => 
Left(CustomRejection(InternalServerError))
-                    case t                        => 
Left(CustomRejection(ServiceUnavailable))
-                }
+    def basicAuth[A](verify: Option[BasicHttpCredentials] => 
Future[Option[A]]) = {
+        authenticateOrRejectWithChallenge[BasicHttpCredentials, A] { creds =>
 
 Review comment:
   the code above tries to return a more informative error when authentication 
fails because the database is not available. I think we are losing this feature 
now. I don't think there was a test for this (it will require mocking a db 
connection and failing it). 
   
   you can simulate this locally and verify this is a small change in behavior 
- if i'm right, then please open an issue to address it separately (this time 
with a test).
   
   edit: confirmed that the new logic reports an internal server error if the 
database connection is severed instead of service unavailable.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to