Updated Example Code for Apache Shiro (#2501)
* added updated example codes * updated example code StringToCharStream * deleted StringToCharStream.java locally * removed redundant file * added code for apache commons collection SetUtils * refactored example code * added example code for bytebuddy * added example code for PCollections * update pom * refactored tests for PCollections * spring security xml config * spring security xml config * remove redundant comment * example code for apache-shiro * updated example code for Vavr Collections * updated Vavr's Collection example * updated Vavr Collection file * updated example code for Apache Shiro
This commit is contained in:
committed by
Zeger Hendrikse
parent
8180274da2
commit
cec17bdbfe
@@ -0,0 +1,45 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.apache.shiro.realm.Realm;
|
||||
import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition;
|
||||
import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
* Created by smatt on 21/08/2017.
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class ShiroSpringApplication {
|
||||
|
||||
private static final transient Logger log = LoggerFactory.getLogger(ShiroSpringApplication.class);
|
||||
|
||||
public static void main(String... args) {
|
||||
SpringApplication.run(ShiroSpringApplication.class, args);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Realm realm() {
|
||||
return new MyCustomRealm();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public ShiroFilterChainDefinition shiroFilterChainDefinition() {
|
||||
DefaultShiroFilterChainDefinition filter
|
||||
= new DefaultShiroFilterChainDefinition();
|
||||
|
||||
filter.addPathDefinition("/secure", "authc");
|
||||
filter.addPathDefinition("/**", "anon");
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user