January 2019
Intermediate to advanced
392 pages
10h 11m
English
This is a module of a security method that's provided by Spring Security. We can provide a role in a particular function so that role-based users can access the function.
The following annotation is used to enable this feature:
@EnableGlobalMethodSecurity(securedEnabled = true)
Here's an example of how to enable method security in the SpringSecurityApplication.kt class, which is the main application class of our demo project:
@SpringBootApplication@EnableGlobalMethodSecurity(securedEnabled = true)class SpringSecurityApplication{ fun main(args: Array<String>) { runApplication<SpringSecurityApplication>(*args) }}
Now you can create the method resources, such as the following code:
@Securedclass CustomService{ @Secured fun ...
Read now
Unlock full access