waffle.servlet.WindowsPrincipal.getGroups()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中waffle.servlet.WindowsPrincipal.getGroups()方法的一些代码示例,展示了WindowsPrincipal.getGroups()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WindowsPrincipal.getGroups()方法的具体详情如下:
包路径:waffle.servlet.WindowsPrincipal
类名称:WindowsPrincipal
方法名:getGroups

WindowsPrincipal.getGroups介绍

[英]Windows groups that the user is a member of.
[中]用户所属的Windows组。

代码示例

代码示例来源:origin: Waffle/waffle

  1. /**
  2. * Instantiates a new windows authentication token.
  3. *
  4. * @param identity
  5. * The {@link WindowsPrincipal} for which this token exists.
  6. * @param grantedAuthorityFactory
  7. * used to construct {@link GrantedAuthority}s for each of the groups to which the
  8. * {@link WindowsPrincipal} belongs
  9. * @param defaultGrantedAuthority
  10. * if not null, this {@link GrantedAuthority} will always be added to the granted authorities list
  11. */
  12. public WindowsAuthenticationToken(final WindowsPrincipal identity,
  13. final GrantedAuthorityFactory grantedAuthorityFactory, final GrantedAuthority defaultGrantedAuthority) {
  14. this.principal = identity;
  15. this.authorities = new ArrayList<>();
  16. if (defaultGrantedAuthority != null) {
  17. this.authorities.add(defaultGrantedAuthority);
  18. }
  19. for (final WindowsAccount group : this.principal.getGroups().values()) {
  20. this.authorities.add(grantedAuthorityFactory.createGrantedAuthority(group));
  21. }
  22. }

代码示例来源:origin: com.github.dblock.waffle/waffle-spring-security4

  1. /**
  2. * Instantiates a new windows authentication token.
  3. *
  4. * @param identity
  5. * The {@link WindowsPrincipal} for which this token exists.
  6. * @param grantedAuthorityFactory
  7. * used to construct {@link GrantedAuthority}s for each of the groups to which the
  8. * {@link WindowsPrincipal} belongs
  9. * @param defaultGrantedAuthority
  10. * if not null, this {@link GrantedAuthority} will always be added to the granted authorities list
  11. */
  12. public WindowsAuthenticationToken(final WindowsPrincipal identity,
  13. final GrantedAuthorityFactory grantedAuthorityFactory, final GrantedAuthority defaultGrantedAuthority) {
  14. this.principal = identity;
  15. this.authorities = new ArrayList<>();
  16. if (defaultGrantedAuthority != null) {
  17. this.authorities.add(defaultGrantedAuthority);
  18. }
  19. for (final WindowsAccount group : this.principal.getGroups().values()) {
  20. this.authorities.add(grantedAuthorityFactory.createGrantedAuthority(group));
  21. }
  22. }

代码示例来源:origin: com.github.waffle/waffle-spring-security3

  1. /**
  2. * Instantiates a new windows authentication token.
  3. *
  4. * @param identity
  5. * The {@link WindowsPrincipal} for which this token exists.
  6. * @param grantedAuthorityFactory
  7. * used to construct {@link GrantedAuthority}s for each of the groups to which the
  8. * {@link WindowsPrincipal} belongs
  9. * @param defaultGrantedAuthority
  10. * if not null, this {@link GrantedAuthority} will always be added to the granted authorities list
  11. */
  12. public WindowsAuthenticationToken(final WindowsPrincipal identity,
  13. final GrantedAuthorityFactory grantedAuthorityFactory, final GrantedAuthority defaultGrantedAuthority) {
  14. this.principal = identity;
  15. this.authorities = new ArrayList<>();
  16. if (defaultGrantedAuthority != null) {
  17. this.authorities.add(defaultGrantedAuthority);
  18. }
  19. for (final WindowsAccount group : this.principal.getGroups().values()) {
  20. this.authorities.add(grantedAuthorityFactory.createGrantedAuthority(group));
  21. }
  22. }

代码示例来源:origin: Waffle/waffle

  1. /**
  2. * Instantiates a new windows authentication token.
  3. *
  4. * @param identity
  5. * The {@link WindowsPrincipal} for which this token exists.
  6. * @param grantedAuthorityFactory
  7. * used to construct {@link GrantedAuthority}s for each of the groups to which the
  8. * {@link WindowsPrincipal} belongs
  9. * @param defaultGrantedAuthority
  10. * if not null, this {@link GrantedAuthority} will always be added to the granted authorities list
  11. */
  12. public WindowsAuthenticationToken(final WindowsPrincipal identity,
  13. final GrantedAuthorityFactory grantedAuthorityFactory, final GrantedAuthority defaultGrantedAuthority) {
  14. this.principal = identity;
  15. this.authorities = new ArrayList<>();
  16. if (defaultGrantedAuthority != null) {
  17. this.authorities.add(defaultGrantedAuthority);
  18. }
  19. for (final WindowsAccount group : this.principal.getGroups().values()) {
  20. this.authorities.add(grantedAuthorityFactory.createGrantedAuthority(group));
  21. }
  22. }

代码示例来源:origin: salyh/elasticsearch-security-plugin

  1. public List<String> getUserRoles() {
  2. if (request.getUserPrincipal() instanceof GenericPrincipal) {
  3. final GenericPrincipal wp = (GenericPrincipal) request
  4. .getUserPrincipal();
  5. if (wp.getRoles() != null) {
  6. final List<String> roles = Arrays.asList(wp.getRoles());
  7. log.debug("GenericPrincipal roles: " + roles);
  8. return roles;
  9. }
  10. }
  11. if (request.getUserPrincipal() instanceof WindowsPrincipal) {
  12. final WindowsPrincipal wp = (WindowsPrincipal) request
  13. .getUserPrincipal();
  14. log.debug("WindowsPrincipal roles: " + wp.getRolesString());
  15. log.debug("WindowsPrincipal groups: " + wp.getGroups());
  16. if (wp.getRolesString() != null) {
  17. return Arrays.asList(wp.getRolesString().split(","));
  18. }
  19. }
  20. /*if (this.request.getUserPrincipal() instanceof ActiveDirectoryPrincipal) {
  21. final ActiveDirectoryPrincipal ap = (ActiveDirectoryPrincipal) this.request
  22. .getUserPrincipal();
  23. log.debug("ActiveDirectoryPrincipal roles: " + ap.getRoles());
  24. return ap.getRoles();
  25. }*/
  26. return null;
  27. }

代码示例来源:origin: com.github.dblock.waffle/waffle-jna

  1. /**
  2. * A windows principal.
  3. *
  4. * @param windowsIdentity
  5. * Windows identity.
  6. * @param principalFormat
  7. * Principal format.
  8. * @param roleFormat
  9. * Role format.
  10. */
  11. public WindowsPrincipal(final IWindowsIdentity windowsIdentity, final PrincipalFormat principalFormat,
  12. final PrincipalFormat roleFormat) {
  13. this.identity = windowsIdentity;
  14. this.fqn = windowsIdentity.getFqn();
  15. this.sid = windowsIdentity.getSid();
  16. this.sidString = windowsIdentity.getSidString();
  17. this.groups = WindowsPrincipal.getGroups(windowsIdentity.getGroups());
  18. this.roles = WindowsPrincipal.getRoles(windowsIdentity, principalFormat, roleFormat);
  19. }

代码示例来源:origin: Waffle/waffle

  1. /**
  2. * A windows principal.
  3. *
  4. * @param windowsIdentity
  5. * Windows identity.
  6. * @param principalFormat
  7. * Principal format.
  8. * @param roleFormat
  9. * Role format.
  10. */
  11. public WindowsPrincipal(final IWindowsIdentity windowsIdentity, final PrincipalFormat principalFormat,
  12. final PrincipalFormat roleFormat) {
  13. this.identity = windowsIdentity;
  14. this.fqn = windowsIdentity.getFqn();
  15. this.sid = windowsIdentity.getSid();
  16. this.sidString = windowsIdentity.getSidString();
  17. this.groups = WindowsPrincipal.getGroups(windowsIdentity.getGroups());
  18. this.roles = WindowsPrincipal.getRoles(windowsIdentity, principalFormat, roleFormat);
  19. }

代码示例来源:origin: com.github.waffle/waffle-jna

  1. /**
  2. * A windows principal.
  3. *
  4. * @param windowsIdentity
  5. * Windows identity.
  6. * @param principalFormat
  7. * Principal format.
  8. * @param roleFormat
  9. * Role format.
  10. */
  11. public WindowsPrincipal(final IWindowsIdentity windowsIdentity, final PrincipalFormat principalFormat,
  12. final PrincipalFormat roleFormat) {
  13. this.identity = windowsIdentity;
  14. this.fqn = windowsIdentity.getFqn();
  15. this.sid = windowsIdentity.getSid();
  16. this.sidString = windowsIdentity.getSidString();
  17. this.groups = WindowsPrincipal.getGroups(windowsIdentity.getGroups());
  18. this.roles = WindowsPrincipal.getRoles(windowsIdentity, principalFormat, roleFormat);
  19. }

相关文章