Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a generic API function across plugins that plugins can use to re-direct to the oauth provider login page #7

Closed
gashcrumb opened this issue Jul 13, 2015 · 1 comment

Comments

@gashcrumb
Copy link
Member

Currently oauth plugins themselves handle redirects to the oauth provider login page, but there's no way for plugins to do a redirect without resorting to provider specific code. We should add an overall 'HawtioOAuth' module with an API that plugins can use to trigger a redirect without having to depend on specific provider code.

@gashcrumb
Copy link
Member Author

There's now a facade module in plugins/includes.ts that provides a couple API functions that plugins can use:

authenticatedHttpRequest(options:any) calls $.ajax() under the covers and returns the promise object, use to make a call with the active provider's token if present.
getOAuthToken() returns the active provider's token.
getUserProfile() returns the active provider's user profile that's also merged into the userDetails service after angular is bootstrapped.
doLogout() makes the active provider clear it's token storage and re-direct to the login screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant