-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Change IRCT Parameter location and retrieving
- Loading branch information
1 parent
76c3277
commit c21f377
Showing
3 changed files
with
35 additions
and
38 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
import javax.servlet.Filter; | ||
import javax.servlet.FilterChain; | ||
import javax.servlet.FilterConfig; | ||
import javax.servlet.ServletContext; | ||
//import javax.servlet.ServletContext; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.ServletRequest; | ||
import javax.servlet.ServletResponse; | ||
|
@@ -42,21 +42,25 @@ | |
*/ | ||
@WebFilter(filterName = "session-filter", urlPatterns = { "/*" }) | ||
public class SessionFilter implements Filter { | ||
|
||
@javax.annotation.Resource(mappedName ="java:global/client_secret") | ||
private String clientId; | ||
@javax.annotation.Resource(mappedName ="java:global/client_id") | ||
private String clientSecret; | ||
@javax.annotation.Resource(mappedName ="java:global/userField") | ||
private String userField; | ||
|
||
@Inject | ||
private ServletContext context; | ||
// @Inject | ||
// private ServletContext context; | ||
|
||
@Inject | ||
private SecurityController sc; | ||
|
||
@Override | ||
public void init(FilterConfig fliterConfig) throws ServletException { | ||
this.clientSecret = context.getInitParameter("client_secret"); | ||
this.clientId = context.getInitParameter("client_id"); | ||
this.userField = context.getInitParameter("userField"); | ||
// this.clientSecret = context.getInitParameter("client_secret"); | ||
// this.clientId = context.getInitParameter("client_id"); | ||
// this.userField = context.getInitParameter("userField"); | ||
} | ||
|
||
@Override | ||
|
@@ -116,6 +120,18 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc) | |
|
||
} | ||
|
||
// HttpSession session = ((HttpServletRequest) req).getSession(); | ||
// | ||
// User user = sc.getUser("[email protected]"); | ||
// Token token = new JWT(((HttpServletRequest) req).getHeader("Authorization"), "", "Bearer", this.clientId); | ||
// SecureSession secureSession = new SecureSession(); | ||
// secureSession.setToken(token); | ||
// secureSession.setUser(user); | ||
// | ||
// session.setAttribute("user", user); | ||
// session.setAttribute("token", token); | ||
// session.setAttribute("secureSession", secureSession); | ||
|
||
fc.doFilter(req, res); | ||
} | ||
|
||
|
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
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