Advertisement
Guest User

Untitled

a guest
Jan 14th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. <global-method-security access-decision-manager-ref="accessDecisionManager2"/>
  2.  
  3. @Bean
  4. public AccessDecisionManager accessDecisionManager2() {
  5. List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>();
  6. Map<String, AccessDecisionVoter> beans = context.getBeansOfType(AccessDecisionVoter.class);
  7. CustomAccessDecisionVoter customAccessDecisionVoter = new CustomAccessDecisionVoter();
  8. decisionVoters.add(customAccessDecisionVoter);
  9.  
  10. AffirmativeBased affirmativeBased = new AffirmativeBased(decisionVoters);
  11.  
  12. return affirmativeBased;
  13. }
  14.  
  15. @Service
  16. public class CustomAccessDecisionVoter extends AuthenticatedVoter{
  17.  
  18.  
  19. @Override
  20. public boolean supports(Class clazz) {
  21. // TODO Auto-generated method stub
  22. return true;
  23. }
  24.  
  25. public int vote(Authentication authentication, FilterInvocation fi,
  26. Collection<ConfigAttribute> attributes) {
  27.  
  28.  
  29. return 0;
  30. }
  31.  
  32. @Override
  33. public boolean supports(ConfigAttribute attribute) {
  34. // TODO Auto-generated method stub
  35. System.out.println(attribute.toString());
  36. return true;
  37. }
  38. }
  39.  
  40. DEBUG [http-bio-8080-exec-10] (OpenEntityManagerInViewInterceptor.java:85) - Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
  41. DEBUG [http-bio-8080-exec-10] (AbstractSecurityInterceptor.java:218) - Secure object: ReflectiveMethodInvocation: public java.lang.String com.DPP.V2.GUIController.PageDispatcher.test(); target is of class [com.DPP.V2.GUIController.PageDispatcher]; Attributes: [[authorize: 'hasAuthority('ROLE_read_only')', filter: 'null', filterTarget: 'null']]
  42. DEBUG [http-bio-8080-exec-10] (AbstractSecurityInterceptor.java:347) - Previously Authenticated: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@a9768c42: Principal: com.DPP.V2.sessions.SessionUser@3b40b2f: Username: ADMIN; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: e17bd41a-0726-47e0-a024-053a0d5d0f6c_grant_sensitive,e17bd41a-0726-47e0-a024-053a0d5d0f6c_test,e17bd41a-0726-47e0-a024-053a0d5d0f6c_write_all; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@380f4: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 6F802321EC029F9588F0D8C0582AD97B; Granted Authorities: e17bd41a-0726-47e0-a024-053a0d5d0f6c_grant_sensitive, e17bd41a-0726-47e0-a024-053a0d5d0f6c_test, e17bd41a-0726-47e0-a024-053a0d5d0f6c_write_all
  43. DEBUG [http-bio-8080-exec-10] (AffirmativeBased.java:65) - Voter: org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter@13882b00, returned: -1
  44. DEBUG [http-bio-8080-exec-10] (AffirmativeBased.java:65) - Voter: org.springframework.security.access.vote.RoleVoter@10ced22f, returned: 0
  45. DEBUG [http-bio-8080-exec-10] (AffirmativeBased.java:65) - Voter: org.springframework.security.access.vote.AuthenticatedVoter@63943f99, return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement