You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2019/10/30 20:14:27 UTC
[juneau-petstore] 26/31: Added spring security support
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau-petstore.git
commit d38611bd9af10e19e18251014c3db3eb7bdfbc29
Author: COMVIVA\ishita.singh <is...@mahindracomviva.com>
AuthorDate: Thu Oct 17 03:00:16 2019 +0530
Added spring security support
---
.../org/apache/juneau/petstore/config/SpringSecurityConfig.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/config/SpringSecurityConfig.java b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/config/SpringSecurityConfig.java
index 593a430..112a3b7 100644
--- a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/config/SpringSecurityConfig.java
+++ b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/config/SpringSecurityConfig.java
@@ -23,10 +23,12 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter{
protected void configure(HttpSecurity http) throws Exception {
http
+ .httpBasic()
+ .and()
.authorizeRequests()
- .antMatchers(HttpMethod.POST, "/pet").hasRole("ADMIN")
- .antMatchers(HttpMethod.PUT, "/pet/**").hasRole("ADMIN")
- .antMatchers(HttpMethod.DELETE, "/pet/**").hasRole("ADMIN")
+ .antMatchers(HttpMethod.POST, "/petstore/pet").hasRole("ADMIN")
+ .antMatchers(HttpMethod.PUT, "/petstore/pet/**").hasRole("ADMIN")
+ .antMatchers(HttpMethod.DELETE, "/petstore/pet/**").hasRole("ADMIN")
.and()
.csrf().disable()
.formLogin().disable();