code: public AppAuth validateAccess(String accessToken, Permission permission) throws TokenNotValidException, PermissionDeniedException {
  		AppAuth appAuth;
  		if (accessToken == null) {
  			throw new TokenNotValidException();
  		}
  
  		appAuth = mAppRegistry.getAppAuthorization(accessToken);
  
  		if ((appAuth.getPermissionCode() & permission.getCode()) == 0) {
  			throw new PermissionDeniedException();
  		}
  
  		return appAuth;
  	}
docs: Local app security