Guest User

Untitled

a guest
Jan 9th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
  2.  
  3. if (!request.post) {
  4. throw new AuthenticationServiceException("not supported: $request.method")
  5. }
  6. String username = (obtainUsername(request) ?: '').trim()
  7. String password = (obtainPassword(request) ?: '').trim()
  8. String extrafield1 = request.getParameter("extrafield1")
  9. String extrafield2 = request.getParameter("extrafield2")
  10.  
  11.  
  12. def authentication = new CustomAuthToken(username, password, extrafield1, null, false, false, false)
  13.  
  14. HttpSession session = request.getSession(false)
  15. if (session || getAllowSessionCreation()) {
  16. request.session['SPRING_SECURITY_LAST_USERNAME_KEY'] = TextEscapeUtils.escapeEntities(username)
  17. }
  18.  
  19. return getAuthenticationManager().authenticate(authentication)
  20. }
  21.  
  22. CustomAuthToken(Object principal, Object credentials, String extrafield1, String PVM, Boolean isAccept, Boolean isLogEnabled, Boolean is3PLEnabled) {
  23. super(principal, credentials)
  24. extra1 = extrafield1
  25. }
  26.  
  27. CustomAuthToken(Object principal, Object credentials, String extrafield1, String extrafield2, String PVM, Boolean isAccept, Boolean isLogEnabled, Boolean is3PLEnabled) {
  28. super(principal, credentials)
  29. extra1 = extrafield1
  30. extra2 = extrafield2
  31. }
Add Comment
Please, Sign In to add comment