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

[security-in-core] Expose userProfile APIs from Core #178932

Closed
pgayvallet opened this issue Mar 19, 2024 · 5 comments · Fixed by #180372
Closed

[security-in-core] Expose userProfile APIs from Core #178932

pgayvallet opened this issue Mar 19, 2024 · 5 comments · Fixed by #180372
Assignees
Labels
Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!

Comments

@pgayvallet
Copy link
Contributor

pgayvallet commented Mar 19, 2024

Part of #174578

This issue is about migrating the userProfile APIs to re-expose them from Core, similar to what was done to authc in #177976

  • We want to expose them from their dedicated service (so core.userProfile and not core.security.userProfile)

  • The public API doesn't need to change, we can re-expose them exactly the same

  • The internal API will need to expose all the APIs for Core to use

    • update is not exposed on the server-side as a public API
  • There is a package about UI components for user profile, but we don't need to do anything about it

  • (Optional) Given we have only few consumers of the userProfiles APIs, we could even adapt the existing consumers to use the new Core APIs and then simply remove them from the security plugin’s contract (if the effort is reasonable)

Tech pointers

Server-side:

/**
* User profiles services to retrieve user profiles.
*/
userProfiles: UserProfileServiceStart;

Browser-side:

/**
* A set of methods to work with Kibana user profiles.
*/
userProfiles: UserProfileAPIClient;

@pgayvallet pgayvallet added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! labels Mar 19, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@pgayvallet
Copy link
Contributor Author

We want to expose them from their dedicated service (so core.userProfile and not core.security.userProfile)

This is the only point we need to figure out. In my initial PR I assumed we would be registering all of security's API from a single registration hook

export interface SecurityServiceSetup {
/**
* Register the security implementation that then will be used and re-exposed by Core.
*
* @remark this should **exclusively** be used by the security plugin.
*/
registerSecurityApi(api: CoreSecurityContract): void;
}

/**
* The contract exposed by the security provider for Core to
* consume and re-expose via its security service.
*
* @public
*/
export interface CoreSecurityContract {
authc: AuthenticationServiceContract;
}

But this also assumed everything was exposed from the same service.

If we want this core.userProfile service, we need to figure out how the registration should be performed.

If we want to keep the registration being done with a single hook (and I think we do), then it means a few things:

  • the userProfile service will depend on the security service (as it will need to retrieve the registered APIs from it)
  • there is something to figure out regarding the type packages
    • as the CoreSecurityContract types from the @kbn/core-security-server and @kbn/core-security-browser will need to know about the userProfile contract

The alternative would be to have a distinct registerUserProfile registration API exposed from our new userProfile service. This will allow to have the types fully isolated. But the downside is that we need to redo all the boilerplate that was done in the previous PR for this new service.

@TinaHeiligers TinaHeiligers self-assigned this Mar 19, 2024
@TinaHeiligers
Copy link
Contributor

As discussed, I tentatively assigned myself to take this work on. We can change that if needed later.

@pgayvallet
Copy link
Contributor Author

We discussed it with @TinaHeiligers today, and came to the agreement that adding a dedicated registration hook for the userProfile API was the best solution, long term.

pgayvallet added a commit that referenced this issue Apr 24, 2024
## Summary

Fix #178932

- Introduce the new `userProfile` core service, both on the browser and
server-side.

- Have the security plugin register its API to Core for re-exposition

---------

Co-authored-by: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants