This commit is contained in:
eugenp 2014-02-21 18:48:07 +01:00
commit 528ef210e4
5 changed files with 8 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import org.junit.Test; import org.junit.Test;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
@ -16,6 +17,8 @@ public class SandboxTest {
testElement.setX(10); testElement.setX(10);
testElement.setY("adasd"); testElement.setY("adasd");
final ObjectMapper om = new ObjectMapper(); final ObjectMapper om = new ObjectMapper();
om.setVisibilityChecker(om.getSerializationConfig().getDefaultVisibilityChecker().withFieldVisibility(JsonAutoDetect.Visibility.ANY).withGetterVisibility(JsonAutoDetect.Visibility.NONE));
final String serialized = om.writeValueAsString(testElement); final String serialized = om.writeValueAsString(testElement);
System.err.println(serialized); System.err.println(serialized);
} }

View File

@ -1,13 +1,10 @@
package org.baeldung.jackson.sandbox; package org.baeldung.jackson.sandbox;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class TestElement { public class TestElement {
int x; int x;
@JsonIgnore private transient String y;
private String y;
public int getX() { public int getX() {
return x; return x;

View File

@ -2,6 +2,6 @@
## Spring Security for REST Example Project ## Spring Security for REST Example Project
### Relevant Articles: ### Relevant Articles:
- [Spring Security Authentication Provider](http://www.baeldung.com/spring-security-authentication-provider) - [Spring Security Authentication Provider](http://www.baeldung.com/spring-security-authentication-provider)
- [Retrieve User Information in Spring Security](http://www.baeldung.com/get-user-in-spring-security)

View File

@ -196,7 +196,7 @@
<dependency> <dependency>
<groupId>com.jayway.restassured</groupId> <groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId> <artifactId>rest-assured</artifactId>
<version>2.2.0</version> <version>2.3.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

View File

@ -10,12 +10,13 @@
<http use-expressions="true" entry-point-ref="restAuthenticationEntryPoint"> <http use-expressions="true" entry-point-ref="restAuthenticationEntryPoint">
<intercept-url pattern="/api/**" access="isAuthenticated()" /> <intercept-url pattern="/api/**" access="isAuthenticated()" />
<sec:form-login authentication-success-handler-ref="mySuccessHandler" /> <sec:form-login authentication-success-handler-ref="mySuccessHandler" authentication-failure-handler-ref="myFailureHandler" />
<logout /> <logout />
</http> </http>
<beans:bean id="mySuccessHandler" class="org.baeldung.security.MySavedRequestAwareAuthenticationSuccessHandler" /> <beans:bean id="mySuccessHandler" class="org.baeldung.security.MySavedRequestAwareAuthenticationSuccessHandler" />
<beans:bean id="myFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler" />
<authentication-manager alias="authenticationManager"> <authentication-manager alias="authenticationManager">
<authentication-provider> <authentication-provider>