Closed andrewferk closed 9 years ago
This is odd. In all of the tests I've run, it does make it to that next line and the default scope is set. Would it be possible for you to share what you have (or some facsimile thereof) for me to try?
I can't think of too many things that would prevent that line from running. The only 2 I've come up with are:
(1) An exception is thrown from the previous line where OAuth2AuthenticationService is created. (Even then, I can't imagine what exception would be thrown) (2) Maybe you are seeing this behavior in a debugger that is showing the current version of the code but the actual executable in play is an older version that doesn't have that line. I've had this kind of thing happen to me from time to time and it can be terribly confusing. If the method is returning immediately after that "final" line, I'd bet that this is what's happening.
Thanks. It was (2). I was using an outdated version of spring-social-samples that was still referencing spring social 1.1.0.
I followed the guide for implementing my own provider and have used others as a reference. We require a scope to be provided when hitting our OAuth2 endpoints, and I'd prefer if the scope can be configured when we create our connection factory:
However, this scope never makes it to the
OAuth2AuthenticationService
. WhenOAuth2AuthenticationService#setScope
executes,defaultScope
is still an empty string. ThedefaultScope
is supposed to be set withinSecurityEnabledConnectionFactoryConfigurer#wrapAsAuthenticationService
, but nothing seems to get executed after thefinal OAuth2AuthenticationService<A> authService = ...
line (I set breakpoints, logs and system out).I don't know what could be preventing the next line to be run, but because it's not running the default scope is never being set.
The workaround is to set the scope as a url parameter, but I'd prefer this to be coded in config.