BearerToken auth in silhouette not working
up vote
0
down vote
favorite
Unable to auth with existing bearer-token in play+silhouette
I use:
trait BTEnv extends Env {
type I = User
type A = BearerTokenAuthenticator
}
controller code:
class RestController @Inject() (
components: ControllerComponents,
silhouette: Silhouette[BTEnv],
socialProviderRegistry: SocialProviderRegistry
)(
implicit
ex: ExecutionContext
) extends AbstractController(components) with I18nSupport with Logger {
def secured = silhouette.SecuredAction(WithProvider[BTEnv#A](CustomProvider.ID)) { implicit request: SecuredRequest[BTEnv, AnyContent] =>
Ok("42")
}
def unsecured = silhouette.UnsecuredAction.async {
implicit request: Request[AnyContent] => Future.successful(Ok("420"))
}
}
gist for custom provider:
https://gist.github.com/iOgre/02a4ed1eff9656e8f9bc57baf0c36d14
gist for silhouette module
https://gist.github.com/iOgre/99222d040461e699146397ae6bd075f3
I have access token received from identity server, and use it when requesting endpoint (def secured ... in provided controller code)
I pass token as:
authorization: Bearer {my-token-here}
and request returns unauthorized and redirects to predefined url
but I can't find where in code the token parsing and validating takes place
I did some debugging, but neither isAuthorized method in WithProvider
case class, nor auth functions in CustomProvider class hierarchy do not run.
at least, breakpoints did not hit
playframework oauth-2.0 bearer-token silhouette
add a comment |
up vote
0
down vote
favorite
Unable to auth with existing bearer-token in play+silhouette
I use:
trait BTEnv extends Env {
type I = User
type A = BearerTokenAuthenticator
}
controller code:
class RestController @Inject() (
components: ControllerComponents,
silhouette: Silhouette[BTEnv],
socialProviderRegistry: SocialProviderRegistry
)(
implicit
ex: ExecutionContext
) extends AbstractController(components) with I18nSupport with Logger {
def secured = silhouette.SecuredAction(WithProvider[BTEnv#A](CustomProvider.ID)) { implicit request: SecuredRequest[BTEnv, AnyContent] =>
Ok("42")
}
def unsecured = silhouette.UnsecuredAction.async {
implicit request: Request[AnyContent] => Future.successful(Ok("420"))
}
}
gist for custom provider:
https://gist.github.com/iOgre/02a4ed1eff9656e8f9bc57baf0c36d14
gist for silhouette module
https://gist.github.com/iOgre/99222d040461e699146397ae6bd075f3
I have access token received from identity server, and use it when requesting endpoint (def secured ... in provided controller code)
I pass token as:
authorization: Bearer {my-token-here}
and request returns unauthorized and redirects to predefined url
but I can't find where in code the token parsing and validating takes place
I did some debugging, but neither isAuthorized method in WithProvider
case class, nor auth functions in CustomProvider class hierarchy do not run.
at least, breakpoints did not hit
playframework oauth-2.0 bearer-token silhouette
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Unable to auth with existing bearer-token in play+silhouette
I use:
trait BTEnv extends Env {
type I = User
type A = BearerTokenAuthenticator
}
controller code:
class RestController @Inject() (
components: ControllerComponents,
silhouette: Silhouette[BTEnv],
socialProviderRegistry: SocialProviderRegistry
)(
implicit
ex: ExecutionContext
) extends AbstractController(components) with I18nSupport with Logger {
def secured = silhouette.SecuredAction(WithProvider[BTEnv#A](CustomProvider.ID)) { implicit request: SecuredRequest[BTEnv, AnyContent] =>
Ok("42")
}
def unsecured = silhouette.UnsecuredAction.async {
implicit request: Request[AnyContent] => Future.successful(Ok("420"))
}
}
gist for custom provider:
https://gist.github.com/iOgre/02a4ed1eff9656e8f9bc57baf0c36d14
gist for silhouette module
https://gist.github.com/iOgre/99222d040461e699146397ae6bd075f3
I have access token received from identity server, and use it when requesting endpoint (def secured ... in provided controller code)
I pass token as:
authorization: Bearer {my-token-here}
and request returns unauthorized and redirects to predefined url
but I can't find where in code the token parsing and validating takes place
I did some debugging, but neither isAuthorized method in WithProvider
case class, nor auth functions in CustomProvider class hierarchy do not run.
at least, breakpoints did not hit
playframework oauth-2.0 bearer-token silhouette
Unable to auth with existing bearer-token in play+silhouette
I use:
trait BTEnv extends Env {
type I = User
type A = BearerTokenAuthenticator
}
controller code:
class RestController @Inject() (
components: ControllerComponents,
silhouette: Silhouette[BTEnv],
socialProviderRegistry: SocialProviderRegistry
)(
implicit
ex: ExecutionContext
) extends AbstractController(components) with I18nSupport with Logger {
def secured = silhouette.SecuredAction(WithProvider[BTEnv#A](CustomProvider.ID)) { implicit request: SecuredRequest[BTEnv, AnyContent] =>
Ok("42")
}
def unsecured = silhouette.UnsecuredAction.async {
implicit request: Request[AnyContent] => Future.successful(Ok("420"))
}
}
gist for custom provider:
https://gist.github.com/iOgre/02a4ed1eff9656e8f9bc57baf0c36d14
gist for silhouette module
https://gist.github.com/iOgre/99222d040461e699146397ae6bd075f3
I have access token received from identity server, and use it when requesting endpoint (def secured ... in provided controller code)
I pass token as:
authorization: Bearer {my-token-here}
and request returns unauthorized and redirects to predefined url
but I can't find where in code the token parsing and validating takes place
I did some debugging, but neither isAuthorized method in WithProvider
case class, nor auth functions in CustomProvider class hierarchy do not run.
at least, breakpoints did not hit
playframework oauth-2.0 bearer-token silhouette
playframework oauth-2.0 bearer-token silhouette
edited Nov 18 at 20:29
asked Nov 18 at 9:44
udovichenko
417
417
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53359551%2fbearertoken-auth-in-silhouette-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown