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

Adding options/functions to retrieve different cloak action endpoint #449

Open
tommynanny opened this issue Nov 7, 2023 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@tommynanny
Copy link

Is your feature request related to a problem? Please describe.
Currently, the gocloak package provides various utility functions for interacting with Keycloak. However, it does not provide a straightforward way to retrieve the endpoints that are constructed and used within these functions. This is an issue when developers need to access the raw endpoints for debugging, logging, or for use with different HTTP clients or custom request handling.

Describe the solution you'd like
I propose adding a complementary function for each existing utility function that returns the endpoint as a string. For instance, alongside the existing LoginAdmin function, a LoginAdminEndpoint function could be introduced:

func (client *gocloak) LoginAdminEndpoint(username, password, realm string) string {
	return authRealms + realm + tokenEndpoint
}

The existing function would then utilize this new endpoint function:

func (client *gocloak) LoginAdmin(username, password, realm string) (*JWT, error) {
	loginPath := client.LoginAdminEndpoint(username, password, realm)
	// ... rest of the function
}

Describe alternatives you've considered
An alternative could be to provide a separate utility structure or function map where endpoints are stored and can be referenced. However, this might add unnecessary complexity compared to the straightforward approach of simply having corresponding endpoint functions.

Additional context
This feature would greatly benefit developers who require access to the raw endpoints for custom use cases such as:

  • Logging the endpoints for monitoring requests and debugging.
  • Using the endpoints with different HTTP clients or custom middleware.
  • Providing the capability to extend the client's functionality without modifying the gocloak source.

No additional context or screenshots are provided at this time, but I am happy to discuss this further and provide examples if needed.

@Nerzal Nerzal added the enhancement New feature or request label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants