Java Security Acl Group Example

How to use

java.security.acl

Best Java code snippets using java.security.acl (Showing top 20 results out of 855)

                                                                                                                                                                                                                            package                                                                                      decorationtest;                                                                                                                                                                                                    import                                                                                      javafx.application.Application;                                                                                                                                            import                                                                                      javafx.stage.StageStyle;                                                                                                                                            import                                                                                      javafx.scene.Group;                                                                                                                                            import                                                                                      javafx.scene.Scene;                                                                                                                                            import                                                                                      javafx.stage.Stage;                                                                                                                                                                                                    public                                                                                                                                                  class                                                                                      DecorationTest                                                                                    extends                                                                                      Application {                                                                                                                                                                                                                                                                                        public                                                                                                                                                  static                                                                                                                                                  void                                                                                      main(String[] args) {                                                                                                                      Application.launch(args);                                                                            }                                                                                                                                    @Override                                                                                                                                                                                      public                                                                                                                                                  void                                                                                      start(Stage primaryStage) {                                                                                                                      primaryStage.initStyle(StageStyle.UNDECORATED);                                                                                                                                                                                  Group root =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                                                    Scene scene =                                                                                    new                                                                                      Scene(root,                                                                                    100                                                              ,                                                                                    100                                                              );                                                                                                                                                                              primaryStage.setScene(scene);                                                                            primaryStage.show();                                                                            }                                                        }                                  
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            private                                                                                      Principal getPrincipal(Subject subject) {                                                                                                                      Principal principal = null;                                                                            Principal callerPrincipal = null;                                                                                                                                                                                      if                                                                                      (subject != null) {                                                                                                                      Set<Principal> principals = subject.getPrincipals();                                                                                                                                                                                      if                                                                                      (principals != null && !principals.isEmpty()) {                                                                                                                                                                                                                                for                                                                                      (Principal p : principals) {                                                                                                                                                                                                                                if                                                                                      (!(p                                                                                    instanceof                                                                                      Group) && principal == null) {                                                                                                                      principal = p;                                                                            }                                                                                                                                                                                      if                                                                                      (p                                                                                    instanceof                                                                                      Group) {                                                                                                                                                                    Group g = Group.                                                              class                                                              .cast(p);                                                                                                                                                                                                                                if                                                                                      (g.                                                              getName                                                              ().equals(SecurityConstants.CALLER_PRINCIPAL_GROUP) && callerPrincipal == null) {                                                                                                                                                                    Enumeration<?                                                                                    extends                                                                                      Principal> e = g.                                                              members                                                              ();                                                                                                                                                                                                                                if                                                                                      (e.hasMoreElements())                                                                                                                      callerPrincipal = e.nextElement();                                                                            }                                                                            }                                                                            }                                                                            }                                                                            }                                                                                                                                                                                      return                                                                                      callerPrincipal == null ? principal : callerPrincipal;                                                                                                  }                                                                                          
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        private                                                                                      Principal getCallerPrincipal(Subject subject) {                                                                                                                      Principal callerPrincipal = null;                                                                                                                                                                                      if                                                                                      (subject != null) {                                                                                                                      Set<Principal> principals = subject.getPrincipals();                                                                                                                                                                                      if                                                                                      (principals != null && !principals.isEmpty()) {                                                                                                                                                                                                                                for                                                                                      (Principal principal : principals) {                                                                                                                                                                                                                                if                                                                                      (principal                                                                                    instanceof                                                                                      Group && principal.getName().equals(CALLER_PRINCIPAL_GROUP)) {                                                                                                                                                                    Enumeration<?                                                                                    extends                                                                                      Principal> enumeration = ((Group) principal).                                                              members                                                              ();                                                                                                                                                                                                                                if                                                                                      (enumeration.hasMoreElements()) {                                                                                                                      callerPrincipal = enumeration.nextElement();                                                                                                                                                                                      break                                                              ;                                                                                                                      }                                                                            }                                                                            }                                                                            }                                                                            }                                                                                                                                                                                      return                                                                                      callerPrincipal;                                                                                                                      }                                                        }                                  
                                                                                                                                              private                                                                                                                                                  void                                                                                      updateSubjectRoles(                                                              final                                                                                      org.jboss.security.SecurityContext jbossSct){                                                                                                                                                                                                                                if                                                                                      (jbossSct == null) {                                                                                                                                                                                                                                throw                                                                                      UndertowLogger.ROOT_LOGGER.nullParamter(                                                              "org.jboss.security.SecurityContext"                                                              );                                                                                                                      }                                                                                                                                    RoleGroup contextRoleGroup = jbossSct.getUtil().getRoles();                                                                                                                                                                                                                                              if                                                              (contextRoleGroup == null){                                                                                                                                                                                                                                return                                                              ;                                                                                                                      }                                                                                                                                    Collection<Role> contextRoles = contextRoleGroup.getRoles();                                                                                                                                                                                                                                              if                                                              (contextRoles.isEmpty()){                                                                                                                                                                                                                                return                                                              ;                                                                                                                      }                                                                                                                                    Subject subject = jbossSct.getUtil().getSubject();                                                                                                                          Set<Group> groupPrincipals = subject.getPrincipals(Group.                                                              class                                                              );                                                                                                                      Group subjectRoleGroup = null;                                                                                                                                                                                                                                              for                                                                                      (Group candidate : groupPrincipals) {                                                                                                                                                                                                                                if                                                                                      (candidate.                                                              getName                                                              ().equals(ROLES_IDENTIFIER)) {                                                                                                                      subjectRoleGroup = candidate;                                                                                                                                                                                      break                                                              ;                                                                                                                      }                                                                            }                                                                                                                                                                                      if                                                                                      (subjectRoleGroup == null) {                                                                                                                                                                    subjectRoleGroup =                                                                                    new                                                                                      SimpleGroup(ROLES_IDENTIFIER);                                                                                                                      subject.getPrincipals().add(subjectRoleGroup);                                                                            }                                                                                                                                                                                      for                                                                                      (Role role : contextRoles) {                                                                                                                                                                    Principal rolePrincipal =                                                                                    new                                                                                      SimplePrincipal(role.getRoleName());                                                                                                                                                                    subjectRoleGroup.                                                              addMember                                                              (rolePrincipal);                                                                                                                      }                                                        }                                                                                          
                                      @Override                                                                                                                                                                protected                                                                                      Group[] getRoleSets()                                                                                    throws                                                                                      LoginException {                                                                                                                                                                    Group roles =                                                                                    new                                                                                      SimpleGroup(                                                              "Roles"                                                              );                                                                                                                                                                    Group callerPrincipal =                                                                                    new                                                                                      SimpleGroup(                                                              "CallerPrincipal"                                                              );                                                                                                                      Group[] groups = { roles, callerPrincipal };                                                                                                                          callerPrincipal.                                                              addMember                                                              (getIdentity());                                                                                                                                                                                                                                return                                                                                      groups;                                                                                                  }                                                                                          
                                      @Override                                                                                                                                                                public                                                                                                                                                  boolean                                                                                      isMember(Principal member) {                                                                                                                                                                                                                                if                                                                                      (_members.containsKey(member)) {                                                                                                                                                                                                                                return                                                                                                                                                  true                                                              ;                                                                                                                      }                                                                                                                                                                                                                                              for                                                                                      (Principal principal : _members.values()) {                                                                                                                                                                                                                                if                                                                                      (principal                                                                                    instanceof                                                                                      Group) {                                                                                                                      Group group = (Group)principal;                                                                                                                                                                                                                                              if                                                                                      (group.                                                              isMember                                                              (member)) {                                                                                                                                                                                                                                return                                                                                                                                                  true                                                              ;                                                                                                                      }                                                                            }                                                                            }                                                                                                                                                                                                                                              return                                                                                                                                                  false                                                              ;                                                                                                  }                                                                                          
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            private                                                                                      Principal getPrincipal(Subject subject) {                                                                                                                      Principal principal = null;                                                                            Principal callerPrincipal = null;                                                                                                                                                                                      if                                                                                      (subject != null) {                                                                                                                      Set<Principal> principals = subject.getPrincipals();                                                                                                                                                                                      if                                                                                      (principals != null && !principals.isEmpty()) {                                                                                                                                                                                                                                for                                                                                      (Principal p : principals) {                                                                                                                                                                                                                                if                                                                                      (!(p                                                                                    instanceof                                                                                      Group) && principal == null) {                                                                                                                      principal = p;                                                                            }                                                                                                                                                                                      if                                                                                      (p                                                                                    instanceof                                                                                      Group) {                                                                                                                                                                    Group g = Group.                                                              class                                                              .cast(p);                                                                                                                                                                                                                                if                                                                                      (g.                                                              getName                                                              ().equals(                                                              "CallerPrincipal"                                                              ) && callerPrincipal == null) {                                                                                                                                                                    Enumeration<?                                                                                    extends                                                                                      Principal> e = g.                                                              members                                                              ();                                                                                                                                                                                                                                if                                                                                      (e.hasMoreElements())                                                                                                                      callerPrincipal = e.nextElement();                                                                            }                                                                            }                                                                            }                                                                            }                                                                            }                                                                                                                                                                                      return                                                                                      callerPrincipal == null ? principal : callerPrincipal;                                                                                                  }                                                                                          
                                                                                                                                                                                                      for                                                                                      (Principal principal : principals) {                                                                                                                                                                                                                                if                                                                                      (principal                                                                                    instanceof                                                                                      Group  && rolePrincipleName.equalsIgnoreCase(principal.getName())) {                                                                                                                                                                    Enumeration<?                                                                                    extends                                                                                      Principal> groups = ((Group) principal).                                                              members                                                              ();                                                                                                                                    
                                                                                                                                                                                                                            package                                                                                      undecorated;                                                                                                                                                                                                    import                                                                                      javafx.application.Application;                                                                                                                                            import                                                                                      javafx.stage.StageStyle;                                                                                                                                            import                                                                                      javafx.scene.Group;                                                                                                                                            import                                                                                      javafx.scene.Scene;                                                                                                                                            import                                                                                      javafx.stage.Stage;                                                                                                                                                                                                    public                                                                                                                                                  class                                                                                      UndecoratedApp                                                                                    extends                                                                                      Application {                                                                                                                                                                                                                                                                                        public                                                                                                                                                  static                                                                                                                                                  void                                                                                      main(String[] args) {                                                                                                                      Application.launch(args);                                                                            }                                                                                                                                    @Override                                                                                                                                                                                      public                                                                                                                                                  void                                                                                      start(Stage primaryStage) {                                                                                                                      primaryStage.initStyle(StageStyle.UNDECORATED);                                                                                                                                                                                  Group root =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                                                    Scene scene =                                                                                    new                                                                                      Scene(root,                                                                                    100                                                              ,                                                                                    100                                                              );                                                                                                                                                                              primaryStage.setScene(scene);                                                                            primaryStage.show();                                                                            }                                                        }                                  
                                                                                                                                                                                                      final                                                                                      Enumeration<?                                                                                    extends                                                                                      Principal> enumeration = group.                                                              members                                                              ();                                                                                                                                                                                                          while                                                                                      (enumeration.hasMoreElements()) {                                                                                                                      groupPrincipals.add(enumeration.nextElement());                                                                                                                                                                                                                        if                                                                                      (applyRoleMappers && SecurityConstants.ROLES_IDENTIFIER.equals(group.                                                              getName                                                              ()) && domainContext.getMappingManager() != null) {                                                                                                                      MappingContext<RoleGroup> mappingContext = domainContext.getMappingManager().getMappingContext(MappingType.ROLE.name());                                                                                                                                                                                      if                                                                                      (mappingContext != null && mappingContext.hasModules()) {                                                                                                                                    
                                      @Override                                                                                                                                                                public                                                                                                                                                  boolean                                                                                      equals(Object obj) {                                                                                                                                                                                                                                if                                                                                      (obj                                                                                    instanceof                                                                                      Group &&                                                                                    super                                                              .equals(obj)) {                                                                                                                      Group that = (Group) obj;                                                                                                                          Enumeration<?                                                                                    extends                                                                                      Principal> thatEnum = that.                                                              members                                                              ();                                                                                                                                                                                                                                int                                                                                      count =                                                                                    0                                                              ;                                                                                                                                                                                                                                                                                        while                                                                                      (thatEnum.hasMoreElements()) {                                                                                                                      Principal thatPrinc = thatEnum.nextElement();                                                                            count++;                                                                                                                                                                                      if                                                                                      (!                                                                                    this                                                              .members.contains(thatPrinc)) {                                                                                                                                                                                                                                return                                                                                                                                                  false                                                              ;                                                                                                                      }                                                                            }                                                                                                                                                                                                                                              return                                                                                      count ==                                                                                    this                                                              .members.size();                                                                                                                                                                    }                                                                                    else                                                                                      {                                                                                                                                                                                                                                return                                                                                                                                                  false                                                              ;                                                                                                                      }                                                        }                                                                                          
                                                                                                                                                                Image tile =                                                                                    new                                                                                      Image(                                                              "tile.png"                                                              );                                                                                                                                                                                                    Group house =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                            house.setCache(                                                              true                                                              );                                                                                                  house.setCacheHint(CacheHint.SPEED);                                                                                                                                                          Effect lighting =                                                                                    new                                                                                      Lighting();                                                                                                                                                                                                    for                                                                                      (                                                              int                                                                                      i =                                                                                    0                                                              ; i < houseWidth; i++) {                                                                                                                                                                                                                                                                                                                                                                                                                        ImageView tileView =                                                                                    new                                                                                      ImageView(tile));                                                                                                                      tileView.setEffect(lighting);                                                                                                                          tileView.setCache(                                                              true                                                              );                                                                                                                      tileView.setCacheHint(CacheHint.SPEED);                                                                                                                                    house.add(tileView);                                                        }                                  
                                                                                                                                                                Group bg =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                            Group fg =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                                                                                                                                                  stage.addActor(bg);                                                        stage.addActor(fg);                                                                                                                bg.addActor(whatever);                                                        fg.addActor(whatever);                                                        bg.addActor(whatever);                                                        fg.addActor(whatever);                                  
                                                                                                                                        Group contentGroup =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                            zoomGroup =                                                                                    new                                                                                      Group();                                                                                                  contentGroup.getChildren().add(zoomGroup);                                                                                          
                                                                                                                                        Group group =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                            Scene scene =                                                                                    new                                                                                      Scene(group);                                                                                                  fxPanel.setScene(scene);                                                                                          
                                                                                                                                        Group root =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                            Scene scene =                                                                                    new                                                                                      Scene(root,                                                                                    400                                                              ,                                                                                    400                                                              );                                                                                                                                    
                                                                                                                                                                                                                            public                                                                                                                                                  class                                                                                      ChatWindow                                                                                    extends                                                                                      Application {                                                                                                                                                                              @Override                                                                                                                                                                                      public                                                                                                                                                  void                                                                                      start(                                                              final                                                                                      Stage stage)                                                                                    throws                                                                                      Exception {                                                                                                                                                                    stage.initStyle(StageStyle.TRANSPARENT);                                                                                                                                                                                                                                                                                                                                    Group rg =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                                                    Scene scene =                                                                                    new                                                                                      Scene(rg,                                                                                    320                                                              ,                                                                                    240                                                              , Color.TRANSPARENT);                                                                                                                      stage.setScene(scene);                                                                            stage.show();                                                                                                                                                                                  Rectangle r =                                                                                    new                                                                                      Rectangle(                                                              5                                                              ,                                                                                    5                                                              , stage.getWidth() -                                                                                    10                                                              , stage.getHeight() -                                                                                    10                                                              );                                                                                                                      r.setFill(Color.STEELBLUE);                                                                                                                          r.setEffect(                                                              new                                                                                      DropShadow());                                                                                                                      rg.getChildren().add(r);                                                                            }                                                                                                                                                                                                                                              public                                                                                                                                                  static                                                                                                                                                  void                                                                                      main(String[] args) {                                                                                                                      launch();                                                                            }                                                        }                                  
                                                                                                                  @Override                                                                                                  public                                                                                                                                                  void                                                                                      start(Stage primaryStage)                                                                                    throws                                                                                      Exception {                                                                                                                                                                    Group sceneRoot =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                                                    Scene scene =                                                                                    new                                                                                      Scene(sceneRoot,                                                                                    600                                                              ,                                                                                    600                                                              ,                                                                                    true                                                              , SceneAntialiasing.BALANCED);                                                                                                                      scene.setFill(Color.BLACK);                                                                                                                          PerspectiveCamera camera =                                                                                    new                                                                                      PerspectiveCamera(                                                              true                                                              );                                                                                                                                                                    camera.setNearClip(                                                              0.1                                                              );                                                                                                                                                                    camera.setFarClip(                                                              10000.0                                                              );                                                                                                                                                                    camera.setTranslateZ(-                                                              4                                                              );                                                                                                                      scene.setCamera(camera);                                                                                                                                                                                  IcosahedronMesh mesh =                                                                                    new                                                                                      IcosahedronMesh();                                                                                                                      mesh.setCullFace(CullFace.FRONT);                                                                                                                          PhongMaterial mat =                                                                                    new                                                                                      PhongMaterial();                                                                                                                                                                    mat.setDiffuseMap(                                                              new                                                                                      Image(getClass().getResourceAsStream(                                                              "icosah_net.png"                                                              )));                                                                                                                      mesh.setMaterial(mat);                                                                                                                          Rotate rotateY =                                                                                    new                                                                                      Rotate(                                                              0                                                              ,                                                                                    0                                                              ,                                                                                    0                                                              ,                                                                                    0                                                              , Rotate.Y_AXIS);                                                                                                                                                                    mesh.getTransforms().addAll(                                                              new                                                                                      Rotate(                                                              30                                                              ,Rotate.X_AXIS),rotateY);                                                                                                                                                                                                                            sceneRoot.getChildren().addAll(mesh,                                                                                    new                                                                                      AmbientLight(Color.WHITE));                                                                                                                                                                                                                            primaryStage.setTitle(                                                              "JavaFX 3D - Icosahedron"                                                              );                                                                                                                      primaryStage.setScene(scene);                                                                            primaryStage.show();                                                        }                                  
                                                                                                                                                                                                      final                                                                                      Group root =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                    
                                                                                                                                                                                                      public                                                                                                                                                  void                                                                                      start(Stage primaryStage)                                                                                    throws                                                                                      Exception {                                                                                                                                                                                                                            Group root =                                                                                    new                                                                                                                                                  Group                                                              ();                                                                                                                                    

overtonfelonfuld.blogspot.com

Source: https://www.tabnine.com/code/java/packages/java.security.acl

0 Response to "Java Security Acl Group Example"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel