Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
134 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am able to configure azure in my grails application and able to authorize the token.
I have a role table in my database and I want to use @Secured annotation with roles in my local database
@Osipalli, Premkiran [ON CONTRACT] Thanks for reaching out. The query is more towards the Spring framework code side rather than specifically towards azure spring apps. I'm not an expert but on a quick search I think you can use Spring Security with Azure AD authentication.
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'com.microsoft.azure:azure-active-directory-spring-boot-starter'
azure:
activedirectory:
tenant-id: <your-tenant-id>
client-id: <your-client-id>
client-secret: <your-client-secret>
user-group:
allowed-groups: <your-allowed-groups>
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private CustomUserDetailsService userDetailsService;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/api/admin/**").hasRole("ADMIN")
.antMatchers("/api/user/**").hasRole("USER")
.anyRequest().authenticated()
.and()
.oauth2Login();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService);
}
}