1 28 29 package com.caucho.server.security; 30 31 import com.caucho.security.BasicPrincipal; 32 33 import java.util.ArrayList ; 34 35 38 public class CachingPrincipal extends BasicPrincipal { 39 private ArrayList <String > _roles; 40 41 44 public CachingPrincipal() 45 { 46 } 47 48 51 public CachingPrincipal(String name) 52 { 53 super(name); 54 } 55 56 61 public Boolean isInRole(String role) 62 { 63 if (_roles == null) 64 return null; 65 else if (_roles.indexOf(role) >= 0) 66 return Boolean.TRUE; 67 else 68 return Boolean.FALSE; 69 } 70 71 74 public void addRole(String role) 75 { 76 if (_roles == null) 77 _roles = new ArrayList <String >(); 78 79 if (! _roles.contains(role)) 80 _roles.add(role); 81 } 82 } 83 | Popular Tags |