Skip to content

Commit

Permalink
Expose ReactiveUserDetailsService to authentication plugins (#6885)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

This PR exposes ReactiveUserDetailsService to authentication plugins.

#### Does this PR introduce a user-facing change?

```release-note
支持在插件中使用 ReactiveUserDetailsService
```
  • Loading branch information
JohnNiang authored Oct 17, 2024
1 parent 8df91e8 commit 02def4e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.cache.CacheManager;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
import org.springframework.security.web.server.context.ServerSecurityContextRepository;
import org.springframework.security.web.server.savedrequest.ServerRequestCache;
import run.halo.app.content.PostContentService;
Expand Down Expand Up @@ -92,6 +93,10 @@ public static ApplicationContext create(ApplicationContext rootContext) {
.ifUnique(userService -> beanFactory.registerSingleton("userService", userService));
rootContext.getBeanProvider(RoleService.class)
.ifUnique(roleService -> beanFactory.registerSingleton("roleService", roleService));
rootContext.getBeanProvider(ReactiveUserDetailsService.class)
.ifUnique(userDetailsService ->
beanFactory.registerSingleton("userDetailsService", userDetailsService)
);
// TODO add more shared instance here

sharedContext.refresh();
Expand Down

0 comments on commit 02def4e

Please sign in to comment.