Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #60 from pablo-parra/new-winauth
Browse files Browse the repository at this point in the history
New winauth modules
  • Loading branch information
amarinso authored Jan 18, 2017
2 parents 3defc3a + 8515d77 commit 2f48b22
Show file tree
Hide file tree
Showing 42 changed files with 713 additions and 141 deletions.
5 changes: 3 additions & 2 deletions modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
<modules>
<module>foo</module>
<module>reporting</module>
<module>i18n</module>
<module>winauth</module>
<module>i18n</module>
<module>winauth-ad</module>
<module>winauth-sso</module>
<module>async</module>
</modules>

Expand Down
8 changes: 1 addition & 7 deletions modules/winauth/pom.xml → modules/winauth-ad/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@
<version>dev-SNAPSHOT</version>
</parent>
<groupId>com.capgemini.devonfw.modules</groupId>
<artifactId>devonfw-winauth</artifactId>
<artifactId>devonfw-winauth-ad</artifactId>
<version>${devonfw.version}</version>
<name>${project.artifactId}</name>
<description>Active Directory base authentication.</description>

<dependencies>
<!-- Waffle dependency -->
<dependency>
<groupId>com.github.dblock.waffle</groupId>
<artifactId>waffle-spring-security3</artifactId>
</dependency>
<!-- END Waffle dependency -->

<dependency>
<groupId>javax.servlet</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.api;
package com.capgemini.devonfw.module.winauthad.common.api;

import org.springframework.security.ldap.authentication.LdapAuthenticationProvider;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.api;
package com.capgemini.devonfw.module.winauthad.common.api;

import javax.naming.directory.Attributes;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.api;
package com.capgemini.devonfw.module.winauthad.common.api;

import java.security.Principal;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.api;
package com.capgemini.devonfw.module.winauthad.common.api;

import java.security.Principal;
import java.util.Collection;
Expand All @@ -8,7 +8,7 @@
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;

import com.capgemini.devonfw.module.winauth.common.api.to.UserDetailsClientToAD;
import com.capgemini.devonfw.module.winauthad.common.api.to.UserDetailsClientToAD;

/**
* Container class for the profile of a user.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.api;
package com.capgemini.devonfw.module.winauthad.common.api;

/**
* Interface to get a user from its login.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.api.accesscontrol;
package com.capgemini.devonfw.module.winauthad.common.api.accesscontrol;

import java.util.Properties;

Expand Down Expand Up @@ -174,10 +174,7 @@ private String getFilter(String searchValue, String searchBy) {

String filter = this.baseFilter;
filter += "(" + searchBy + "=" + searchValue + "))";
/*
* if (searchBy.equals("email")) { filter += "(mail=" + searchValue + "))"; } else if (searchBy.equals("username"))
* { filter += "(samaccountname=" + searchValue + "))"; }
*/

return filter;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.api.security;
package com.capgemini.devonfw.module.winauthad.common.api.security;

import java.security.Principal;
import java.util.Collection;
Expand All @@ -8,8 +8,8 @@
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;

import com.capgemini.devonfw.module.winauth.common.api.PrincipalProfile;
import com.capgemini.devonfw.module.winauth.common.api.to.UserDetailsClientToAD;
import com.capgemini.devonfw.module.winauthad.common.api.PrincipalProfile;
import com.capgemini.devonfw.module.winauthad.common.api.to.UserDetailsClientToAD;

/**
* Container class for the profile of a user.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.capgemini.devonfw.module.winauth.common.api.to;
package com.capgemini.devonfw.module.winauthad.common.api.to;

import java.util.List;

import com.capgemini.devonfw.module.winauth.common.api.PrincipalProfile;
import com.capgemini.devonfw.module.winauthad.common.api.PrincipalProfile;

import io.oasp.module.basic.common.api.to.AbstractTo;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.impl.security;
package com.capgemini.devonfw.module.winauthad.common.impl.security;

import java.util.Properties;

Expand All @@ -16,7 +16,7 @@
import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;
import org.springframework.security.ldap.userdetails.UserDetailsContextMapper;

import com.capgemini.devonfw.module.winauth.common.api.AuthenticationManagerAD;
import com.capgemini.devonfw.module.winauthad.common.api.AuthenticationManagerAD;

/**
* Implementation of {@link AuthenticationManagerAD}
Expand Down Expand Up @@ -149,12 +149,6 @@ public void setUserDetailsContextMapper(UserDetailsContextMapper userDetailsCont
this.userDetailsContextMapper = userDetailsContextMapper;
}

// @Bean
// public UserDetailsContextMapper UserDetailsContextMapper() {
//
// return new UserDetailsContextMapperAD();
// }

/**
* The class BindAuthenticator in the package {@link org.springframework.security.ldap.authentication} implements the
* bind authentication strategy. It simply attempts to bind as the user.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.impl.security;
package com.capgemini.devonfw.module.winauthad.common.impl.security;

import java.util.Properties;

Expand All @@ -17,8 +17,8 @@
import org.springframework.security.config.annotation.authentication.configurers.ldap.LdapAuthenticationProviderConfigurer;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import com.capgemini.devonfw.module.winauth.common.api.AuthenticationSource;
import com.capgemini.devonfw.module.winauth.common.api.accesscontrol.ActiveDirectory;
import com.capgemini.devonfw.module.winauthad.common.api.AuthenticationSource;
import com.capgemini.devonfw.module.winauthad.common.api.accesscontrol.ActiveDirectory;

/**
* Implementation of {@link AuthenticationSource}
Expand Down Expand Up @@ -186,7 +186,7 @@ public Attributes searchUserByUsername(String searchValue) {
} finally {
this.activeDirectory.closeLdapConnection();
}
// (&((&(objectCategory=Person)(objectClass=User)))(samaccountname=Servidor Web))

try {
Attributes attrs = result.next().getAttributes();
return attrs;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.impl.security;
package com.capgemini.devonfw.module.winauthad.common.impl.security;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.capgemini.devonfw.module.winauth.common.impl.security;
package com.capgemini.devonfw.module.winauthad.common.impl.security;

import java.util.Collection;

import javax.inject.Named;

import com.capgemini.devonfw.module.winauth.common.api.PrincipalProfile;
import com.capgemini.devonfw.module.winauthad.common.api.PrincipalProfile;

import io.oasp.module.security.common.api.accesscontrol.PrincipalAccessControlProvider;

/**
* Implementation of PrincipalAccessControlProvider
*
*
* @author jhcore
*/
@Named
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.capgemini.devonfw.module.winauth.common.impl.security;
package com.capgemini.devonfw.module.winauthad.common.impl.security;

import java.util.List;
import java.util.Locale;

import com.capgemini.devonfw.module.winauth.common.api.PrincipalProfile;
import com.capgemini.devonfw.module.winauthad.common.api.PrincipalProfile;

/**
* Implementation of {@link PrincipalProfile}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.common.impl.security;
package com.capgemini.devonfw.module.winauthad.common.impl.security;

import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -15,15 +15,14 @@
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.ldap.userdetails.UserDetailsContextMapper;

import com.capgemini.devonfw.module.winauth.common.api.AuthenticationSource;
import com.capgemini.devonfw.module.winauth.common.api.UserData;
import com.capgemini.devonfw.module.winauthad.common.api.AuthenticationSource;
import com.capgemini.devonfw.module.winauthad.common.api.UserData;

/**
* Implementation of {@link UserDetailsContextMapper}
*
* @author jhcore
*/
// @Named("UserDetailsContextMapperAD")
public class UserDetailsContextMapperAD implements UserDetailsContextMapper {

private static final Logger LOG = LoggerFactory.getLogger(AuthenticationManagerImpl.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.capgemini.devonfw.module.winauthad.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
* Spring Boot autoconfiguration for WinauthAD module
*
* @author pparrado
*
*/
@Configuration
@ComponentScan(basePackages = { "com.capgemini.devonfw.module.winauthad" })
public class ModuleConfig {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.capgemini.devonfw.module.winauthad.config.ModuleConfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.base;
package com.capgemini.devonfw.module.winauthad.base;

import javax.inject.Inject;

Expand All @@ -7,9 +7,8 @@
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.capgemini.devonfw.module.winauth.SpringBootApp;
import com.capgemini.devonfw.module.winauth.common.api.AuthenticationManagerAD;
import com.capgemini.devonfw.module.winauth.common.impl.security.AuthenticationManagerImpl;
import com.capgemini.devonfw.module.winauthad.common.api.AuthenticationManagerAD;
import com.capgemini.devonfw.module.winauthad.common.impl.security.AuthenticationManagerImpl;

import io.oasp.module.test.common.base.ComponentTest;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.base;
package com.capgemini.devonfw.module.winauthad.base;

import javax.inject.Inject;

Expand All @@ -7,9 +7,8 @@
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.capgemini.devonfw.module.winauth.SpringBootApp;
import com.capgemini.devonfw.module.winauth.common.api.AuthenticationSource;
import com.capgemini.devonfw.module.winauth.common.impl.security.AuthenticationSourceADImpl;
import com.capgemini.devonfw.module.winauthad.common.api.AuthenticationSource;
import com.capgemini.devonfw.module.winauthad.common.impl.security.AuthenticationSourceADImpl;

import io.oasp.module.test.common.base.ComponentTest;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.base;
package com.capgemini.devonfw.module.winauthad.base;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -10,8 +10,7 @@
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.capgemini.devonfw.module.winauth.SpringBootApp;
import com.capgemini.devonfw.module.winauth.common.impl.security.GroupMapperAD;
import com.capgemini.devonfw.module.winauthad.common.impl.security.GroupMapperAD;

import io.oasp.module.test.common.base.ComponentTest;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.capgemini.devonfw.module.winauth;
package com.capgemini.devonfw.module.winauthad.base;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SuppressWarnings("javadoc")
@SpringBootApplication
// @EntityScan(basePackages = { "devonfw.winauthSample" })
@ComponentScan(basePackages = { "com.capgemini.devonfw.module.winauthad" })
public class SpringBootApp {
/**
* Entry point for spring-boot based app
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.capgemini.devonfw.module.winauth.base;
package com.capgemini.devonfw.module.winauthad.base;

import javax.inject.Inject;

Expand All @@ -7,8 +7,7 @@
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.capgemini.devonfw.module.winauth.SpringBootApp;
import com.capgemini.devonfw.module.winauth.common.impl.security.UserDetailsContextMapperAD;
import com.capgemini.devonfw.module.winauthad.common.impl.security.UserDetailsContextMapperAD;

import io.oasp.module.test.common.base.ComponentTest;

Expand Down
Loading

0 comments on commit 2f48b22

Please sign in to comment.