Skip to content

Commit 4c95bc3

Browse files
committed
Recover to None if an authenticator builder fails
1 parent 44193d5 commit 4c95bc3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
master -
2+
- Recover to None if an authenticator builder fails
23
- Fixed #601: Security: password reset email host injection
34
3.0-M6 - 2017-02-17
45
- Upgraded to Play 2.5.12

module-code/app/securesocial/core/services/AuthenticatorService.scala

+7-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import scala.reflect.ClassTag
2323
import org.apache.commons.lang3.reflect.TypeUtils
2424

2525
class AuthenticatorService[U](builders: AuthenticatorBuilder[U]*)(implicit val executionContext: ExecutionContext) {
26-
val asMap = builders.map { builder => builder.id -> builder }.toMap
26+
private val logger = play.api.Logger(getClass.getName)
27+
private val asMap = builders.map { builder => builder.id -> builder }.toMap
2728

2829
def find(id: String): Option[AuthenticatorBuilder[U]] = {
2930
asMap.get(id)
@@ -46,6 +47,10 @@ class AuthenticatorService[U](builders: AuthenticatorBuilder[U]*)(implicit val e
4647
}
4748
}
4849
}
49-
iterateIt(builders)
50+
iterateIt(builders) recover {
51+
case t: Throwable =>
52+
logger.error(s"An error occurred while trying to build an authenticator from a request", t)
53+
None
54+
}
5055
}
5156
}

0 commit comments

Comments
 (0)