Skip to content

Instantly share code, notes, and snippets.

<envEvento versao="1.00" xmlns="http://www.portalfiscal.inf.br/nfe">
<idLote>1</idLote>
<evento versao="1.00" xmlns="http://www.portalfiscal.inf.br/nfe">
<infEvento Id="ID110111351612xxxxxxxxxxxxxx55001000000201114809581501">
<cOrgao>35</cOrgao>
<tpAmb>2</tpAmb>
<CNPJ>xxxxxxxxxxxxxx</CNPJ>
<chNFe>35161207031405000136550010000002011148095815</chNFe>
<dhEvento>2016-12-06T12:22:30-02:00</dhEvento>
<tpEvento>110111</tpEvento>
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
private static final Logger LOGGER = LoggerFactory.getLogger(SecurityConfiguration.class);
@Autowired
private WebAuthenticationProvider authenticationProvider;
@Autowired
private LoginAuthenticationSuccessHandler loginAuthenticationSuccessHandler;
@efraimcf
efraimcf / MyCustomAuthenticationProvider.java
Last active August 29, 2015 14:22
LDAP Authentication Provider customized to get username for every attempt
package br.com.project.auth;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.ldap.authentication.LdapAuthenticationProvider;
@efraimcf
efraimcf / spring-security.xml
Created June 2, 2015 13:26
Configuration for Spring security with LDAP Authentication
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd">
<security:http auto-config="true" use-expressions="true">
@efraimcf
efraimcf / application-config.xml
Created April 8, 2015 13:44
Application Configuration for Hibernate and 2 Databases
...
<bean id="dataSourceMySql" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://mysql.host:3306/test" />
<property name="username" value="mysql_user" />
<property name="password" value="mysql_pass" />
</bean>
<bean id="dataSourceOracle" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />