Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-14333

[Docs] Fix code snippets in the Embedded guide

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • Major
    • 14.0.3.Final
    • 14.0.2.Final
    • Documentation
    • None

    Description

      1) in Embedded guide, the code snippet here (in 3.2 chapter's 3rd point) does not compile, the GlobalRoleConfigurationBuilder should be GlobalConfigurationBuilder.

      So the code should look like:

      GlobalConfigurationBuilder global = new GlobalConfigurationBuilder();
      global.security().authorization().enable()
              .principalRoleMapper(new ClusterRoleMapper())
              .role("admin").permission(AuthorizationPermission.ADMIN)
              .role("reader").permission(AuthorizationPermission.ALL_READ); 
      2) In 3.3 chapter's  procedure's 2nd point the code doesn't compile. The MutablePermissionMapper should be  MutableRolePermissionMapper .
      

      So the code should look like:

      MutableRolePermissionMapper mapper = (MutableRolePermissionMapper) cacheManager.getCacheManagerConfiguration().security().authorization().rolePermissionMapper();
      mapper.addRole(Role.newRole("myroleone", true, AuthorizationPermission.ALL_WRITE, AuthorizationPermission.LISTEN));
      mapper.addRole(Role.newRole("myroletwo", true, AuthorizationPermission.READ, AuthorizationPermission.WRITE)); 
      

      3) In 3.4 chapter's procedure's 2nd point the code doesn't compile because of missing brackets. The code should be:

      Security.doAs(mySubject, (PrivilegedAction<String>)() -> cache.put("key", "value")); 
       

      Attachments

        Activity

          People

            dvagnero@redhat.com Dominika Borges
            dvagnero@redhat.com Dominika Borges
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: