This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableWebSecurity | |
public class SecurityConfig extends WebSecurityConfigurerAdapter { | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http.logout().disable(); | |
http.formLogin().disable(); | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableWebSecurity | |
public class SecurityConfig extends WebSecurityConfigurerAdapter { | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http.httpBasic().disable(); | |
// ... | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableWebSecurity | |
public class SecurityConfig extends WebSecurityConfigurerAdapter { | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http.anonymous().disable(); | |
// ... | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableWebSecurity | |
public class SecurityConfig extends WebSecurityConfigurerAdapter { | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
// ... | |
http.authorizeRequests() | |
.antMatchers(HttpMethod.GET).access("#oauth2.hasScope('get')") | |
.antMatchers(HttpMethod.POST).access(""#oauth2.hasScope('post')"") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableWebSecurity | |
public class SecurityConfig extends WebSecurityConfigurerAdapter { | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http.rememberMe().disable(); | |
http.authorizeRequests() | |
.antMatchers("/api/foo").hasRole("bar") | |
.antMatchers("/api/bat").hasRole("foo") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableWebSecurity | |
public class SecurityConfig extends WebSecurityConfigurerAdapter { | |
// ... | |
@Bean | |
@Override | |
public AuthenticationManager authenticationManagerBean() throws Exception { | |
return super.authenticationManagerBean(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gypsyengineer.jackson.unsafe.one; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.json.JsonMapper; | |
import com.fasterxml.jackson.databind.jsontype.BasicPolymorphicTypeValidator; | |
import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator; | |
public class SaferPersonDeserialization { | |
private static final String bad = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gypsyengineer.jackson.unsafe.one; | |
import com.fasterxml.jackson.annotation.JsonTypeInfo; | |
import java.io.Serializable; | |
public class Person { | |
public String name; | |
public int age; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClassicSwitchStatement { | |
enum Person { | |
Mozart, Picasso, Goethe, Dostoevsky, Prokofiev, Dali | |
} | |
public static void main(String[] args) { | |
print(Person.Mozart); | |
print(Person.Dali); | |
print(Person.Dostoevsky); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WhoIsWho { | |
enum Person { | |
Mozart, Picasso, Goethe, Dostoevsky, Prokofiev, Dali | |
} | |
public static void main(String[] args) { | |
print(Person.Mozart); | |
print(Person.Dali); | |
print(Person.Dostoevsky); |