This message was deleted.
# questions
s
This message was deleted.
g
I would much appreciate it, I'm opening a thread here, let me know instead if you prefer other channels to chat about it
g
Here is fine. Also, you might take more time depending on how you use the integration. We are strictly using it for SSO authentication, without self-signup, and in our configuration, we are only enabling one provider at a time, because we are using it as SSO. Although I think Cognito, AD, and Okra providers lend themselves to be used as SSO rather than the use case of a website that uses sites like Facebook and Google just to have a logon for user convenience, for things like commenting.
g
Yep, we need it as SSO as well
I mean authentication
g
So in the implementation I'm working with I have these three files extended with the methods we override: OAuth2SpringToken
Copy code
getProviderName
getSocialId //used this for username
getScreenName /used this for email
DefaultApi20
Copy code
getAccessTokenEndpoint //get this from config which is <cognito domain>/oauth2/token
etAuthorizationBaseUrl //get this from config which is <cognito domain>/oauth2/authorize
getAccessTokenExtractor //used OpenIdJsonTokenExtractor
OAuth2AbstractProviderService
Copy code
getProviderID // whatever you want to call your provider, probably cognito.
getApiClass //points to your API implementtion
getProfileScope // come from config <cognito domain>/oauth2/userInfo
getScopeSeparator // not sure what this was for but we have " " 
createSpringAuthToken // parses the OAuth2AccessToken to get the email and id that could be used to look up the user and puts them in a OAuth2SpringToken
we also have the flowing added to our login controller:
Copy code
oauth2Exception
oauth2Success // takes the OAuth2AccessToken looks up the user and creates OAuth2SpringToken by calling createSpringAuthToken, adds the token to SecurityContextHolder.context.authentication, and redirects
as you've seen from the plugin you can register your implementation of OAuth2AbstractProviderService in the plugin groovy file or if you do the code inline in your app you can also do this in BootStrap.groovy That should help you out some and maybe save you some time. Plus by going over this I found something that we were overriding that we didn't need to.
g
Is it okay if I say that I love you? 😎
😂 1
g
Little awkward... but I'll allow it.
g
Lol 😂 thank you for tour help, much appreciated 👍🏻