commit
fb3ed7288c
|
@ -213,7 +213,7 @@ There are convenience mechanisms to make this easier, but this is still not inte
|
||||||
.Java
|
.Java
|
||||||
[source,java,role="primary",attrs="-attributes"]
|
[source,java,role="primary",attrs="-attributes"]
|
||||||
----
|
----
|
||||||
User user = User.withDefaultPasswordEncoder()
|
UserDetails user = User.withDefaultPasswordEncoder()
|
||||||
.username("user")
|
.username("user")
|
||||||
.password("password")
|
.password("password")
|
||||||
.roles("user")
|
.roles("user")
|
||||||
|
@ -243,12 +243,12 @@ If you are creating multiple users, you can also reuse the builder:
|
||||||
[source,java,role="primary"]
|
[source,java,role="primary"]
|
||||||
----
|
----
|
||||||
UserBuilder users = User.withDefaultPasswordEncoder();
|
UserBuilder users = User.withDefaultPasswordEncoder();
|
||||||
User user = users
|
UserDetails user = users
|
||||||
.username("user")
|
.username("user")
|
||||||
.password("password")
|
.password("password")
|
||||||
.roles("USER")
|
.roles("USER")
|
||||||
.build();
|
.build();
|
||||||
User admin = users
|
UserDetails admin = users
|
||||||
.username("admin")
|
.username("admin")
|
||||||
.password("password")
|
.password("password")
|
||||||
.roles("USER","ADMIN")
|
.roles("USER","ADMIN")
|
||||||
|
|
|
@ -820,7 +820,7 @@ Authentication authentication = this.authenticationManager.authenticate(token);
|
||||||
// ...
|
// ...
|
||||||
SecurityContext context = SecurityContextHolder.createEmptyContext(); <1>
|
SecurityContext context = SecurityContextHolder.createEmptyContext(); <1>
|
||||||
context.setAuthentication(authentication); <2>
|
context.setAuthentication(authentication); <2>
|
||||||
SecurityContextHolder.setContext(authentication); <3>
|
SecurityContextHolder.setContext(context); <3>
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue