public interface IBTTSecurityManager { public boolean validateUserByPassword(String userId, String password) throws BTTSecurityException; public boolean checkAccess(String nameOfService, String userId) throws BTTSecurityException; public List<String> checkAvailableServices(String userId, List<String> serviceList) throws BTTSecurityException;}
Used to authenticate a user based on the password, and check whether the user is active.
Used to check if the user that is specified by the userId value is authorized to access the service which is specified by the nameOfService value.
Used to filter the service list based on the authorization of the user that is specified by the userId value and return the filtered list.
The following is the sample code for using the IBTTSecurityManager interface on the server side.
BasicElementFactory factory = new BasicElementFactory("jar:///config/ branch001.xml"); ISecurityObjectManager securitymanager = (BTTSecurityManager) factory.getElement("securityManager"); if (securitymanager.validateUserByPassword(“userId”, “password”)){ if (securitymanager.checkAccess("service01", "user01")){ // access or execute "service01" } List<String> serviceList = new ArrayList<String>(); serviceList.add("service01"); serviceList.add("service02"); List<String>alist = securitymanager.checkAvailableServices("user01", serviceList); // access or execute the Services in the alist. }
You can also use the interface on the client side on the BTT Service Connector. The usage on the client side is the same as that on the server side.