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 | |
@EnableWebMvcSecurity | |
@ComponentScan(basePackageClasses = UserRepositoryUserDetailsService.class) | |
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { | |
@Autowired | |
private UserDetailsService userDetailsService; | |
@Configuration | |
@EnableGlobalMethodSecurity(prePostEnabled = true) | |
static class MethodSecurityConfiguration extends GlobalMethodSecurityConfiguration { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<beans:beans xmlns="http://www.springframework.org/schema/security" | |
xmlns:beans="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | |
http://www.springframework.org/schema/security | |
http://www.springframework.org/schema/security/spring-security.xsd"> | |
<http pattern="/css/**" security="none"/> |
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.fg.http.csrf; | |
import org.apache.commons.codec.binary.Base32; | |
import org.springframework.web.util.WebUtils; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpSession; | |
import java.security.SecureRandom; | |
import java.util.Random; |
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
private static class SerializableProxyDescriptor implements Serializable { | |
private static final long serialVersionUID = 8401525823871149500L; | |
private final Class mainClass; | |
private final Class[] interfaces; | |
private final Object target; | |
private final DeserializationProxyFactory deserializationProxyFactory; | |
private final Map<String, Object> pojoFields = new HashMap<String, Object>(); | |
private SerializableProxyDescriptor(Class mainClass, Class[] interfaces, Object target, DeserializationProxyFactory deserializationProxyFactory) { | |
this.mainClass = mainClass; |
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
@Override | |
public boolean equals(Object o) { | |
if(this == o) return true; | |
if(o == null || getClass() != o.getClass()) return false; | |
Cell cell = (Cell)o; | |
if(x != cell.x) return false; | |
if(y != cell.y) return false; |
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.fg.newsfeed.dao; | |
import com.fg.metadata.business.SqlContainerQueryInterceptor; | |
import com.fg.metadata.business.SqlOneToManyBundleQueryInterceptor; | |
import com.fg.metadata.business.dto.ContainerId; | |
import com.fg.metadata.model.config.MetadataBundleDefinition; | |
import com.fg.metadata.model.config.MetadataContainerDefinition; | |
import com.fg.metadata.model.query.AdamQuery; | |
import com.fg.metadata.storage.model.Join; | |
import com.fg.metadata.storage.model.QueryDecomposition; |
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
Quiz: | |
Try to replace request.getRequestURI() in #commence method with custom value retrieved from request attribute: | |
org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint | |
org.springframework.security.web.access.channel.RetryWithHttpEntryPoint | |
Try to override org.springframework.security.web.DefaultRedirectStrategy, but reuse complex logic in org.springframework.security.web.DefaultRedirectStrategy#calculateRedirectUrl |
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
{ | |
"data": [ | |
{ | |
"x": 403, | |
"y": 907, | |
"count": 1, | |
"price": 0 | |
}, | |
{ | |
"x": 801, |
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 interface DateConversionHelper { | |
static LocalDateTime fromXmlDate(XMLGregorianCalendar calendar) { | |
if (calendar == null) { | |
return null; | |
} | |
final int year = calendar.getYear() > 0 ? calendar.getYear() : 0; | |
final int month = calendar.getMonth(); | |
final int day = calendar.getDay(); | |
final int hour = calendar.getHour() > 0 ? calendar.getHour() : 0; |
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
private Map<Integer, ? extends Address> getAddressIndex(Optional<SubjectData> currentSubjectData) { | |
return currentSubjectData | |
.map( | |
subjectData -> subjectData.getAddresses() | |
.stream() | |
.filter(address -> address.getEsoId() != null) | |
.collect(toMap(Address::getEsoId, t -> t)) | |
).orElse( | |
emptyMap() | |
); |