-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at adding a custom new user filter.
- Loading branch information
Bill Smith
committed
Jan 15, 2019
1 parent
11df915
commit a6ed8ff
Showing
2 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
pac4j-module/src/main/java/net/unicon/shibui/pac4j/AddNewUserFilter.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package net.unicon.shibui.pac4j; | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.security.repository.UserRepository; | ||
import org.springframework.security.core.userdetails.UserDetails; | ||
|
||
import javax.servlet.Filter; | ||
import javax.servlet.FilterChain; | ||
import javax.servlet.FilterConfig; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.ServletRequest; | ||
import javax.servlet.ServletResponse; | ||
import javax.servlet.http.HttpServletRequest; | ||
import java.io.IOException; | ||
import java.security.Principal; | ||
|
||
/** | ||
* @author Bill Smith (wsmith@unicon.net) | ||
*/ | ||
public class AddNewUserFilter implements Filter { | ||
|
||
private UserRepository userRepository; | ||
|
||
public AddNewUserFilter(UserRepository userRepository) { | ||
this.userRepository = userRepository; | ||
} | ||
|
||
@Override | ||
public void init(FilterConfig filterConfig) throws ServletException { | ||
|
||
} | ||
|
||
@Override | ||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { | ||
Principal principal = ((HttpServletRequest) request).getUserPrincipal(); | ||
String username = principal.getName(); | ||
System.out.println("WOO! Principal: " + username); | ||
|
||
chain.doFilter(request, response); | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
|
||
} | ||
} |
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