private Object resolveInAccount(ELContext context, Account account, String property) { Object value = null; if ("id".equals(property)) { context.setPropertyResolved(true); value = account.getId(); } else if ("partition".equals(property)) { context.setPropertyResolved(true); value = account.getPartition(); } else if ("attributes".equals(property)) { context.setPropertyResolved(true); value = getAttributes(account); } return value; }
private boolean isLoggedIn(String username) { return identity.isLoggedIn() && identity.getAccount().getId().equals(username); } }
Partition partition = account.getPartition();
if (!validatedAccount.isEnabled()) { throw new LockedAccountException("Account [" + validatedAccount + "] is disabled.");
/** * <p>Checks if an authenticated user is setted with an attribute with the given name.</p> * * <p>This method requires that valid {@link ELEvaluationContext} associated with the current * invation thread.</p> * * @param attributeName The attribute's name. * * @return True if the user is setted with the attribute. Otherwise, returns false. */ public static boolean hasAttribute(String attributeName) { ELEvaluationContext evaluationContext = ELEvaluationContext.get(); Identity identity = evaluationContext.getIdentity(); Account account = identity.getAccount(); if (account != null && account.getAttribute(attributeName) != null) { return true; } return false; }
preparedStatement = connection.prepareStatement(sql); preparedStatement.setString(1, groupMembership.getId()); preparedStatement.setString(2, groupMembership.getMember().getId()); preparedStatement.setString(3, groupMembership.getGroup().getId()); preparedStatement.setString(4, groupMembership.getClass().getName());
Partition partition = account.getPartition();
if (!validatedAccount.isEnabled()) { throw new LockedAccountException("Account [" + validatedAccount + "] is disabled.");
/** * <p>Checks if an authenticated user is setted with an attribute with the given name.</p> * * <p>This method requires that valid {@link ELEvaluationContext} associated with the current * invation thread.</p> * * @param attributeName The attribute's name. * * @return True if the user is setted with the attribute. Otherwise, returns false. */ public static boolean hasAttribute(String attributeName) { ELEvaluationContext evaluationContext = ELEvaluationContext.get(); Identity identity = evaluationContext.getIdentity(); Account account = identity.getAccount(); if (account != null && account.getAttribute(attributeName) != null) { return true; } return false; }
private Object resolveInAccount(ELContext context, Account account, String property) { Object value = null; if ("id".equals(property)) { context.setPropertyResolved(true); value = account.getId(); } else if ("partition".equals(property)) { context.setPropertyResolved(true); value = account.getPartition(); } else if ("attributes".equals(property)) { context.setPropertyResolved(true); value = getAttributes(account); } return value; }
preparedStatement = connection.prepareStatement(sql); preparedStatement.setString(1, groupMembership.getId()); preparedStatement.setString(2, groupMembership.getMember().getId()); preparedStatement.setString(3, groupMembership.getGroup().getId()); preparedStatement.setString(4, groupMembership.getClass().getName());
Partition partition = account.getPartition();
if (!validatedAccount.isEnabled()) { throw new LockedAccountException("Account [" + validatedAccount + "] is disabled.");
/** * <p>Checks if an authenticated user is setted with an attribute with the given name.</p> * * <p>This method requires that valid {@link ELEvaluationContext} associated with the current * invation thread.</p> * * @param attributeName The attribute's name. * * @return True if the user is setted with the attribute. Otherwise, returns false. */ public static boolean hasAttribute(String attributeName) { ELEvaluationContext evaluationContext = ELEvaluationContext.get(); Identity identity = evaluationContext.getIdentity(); Account account = identity.getAccount(); if (account != null && account.getAttribute(attributeName) != null) { return true; } return false; }
private Object resolveInAccount(ELContext context, Account account, String property) { Object value = null; if ("id".equals(property)) { context.setPropertyResolved(true); value = account.getId(); } else if ("partition".equals(property)) { context.setPropertyResolved(true); value = account.getPartition(); } else if ("attributes".equals(property)) { context.setPropertyResolved(true); value = getAttributes(account); } return value; }
if (account.isEnabled()) { if (isDebugEnabled()) { CREDENTIAL_LOGGER.debugf("Account [%s] is ENABLED.", account, credentials);
@Override protected boolean validateCredential(IdentityContext context, CredentialStorage credentialStorage, UsernamePasswordCredentials credentials, LDAPIdentityStore ldapIdentityStore) { Account account = getAccount(context, credentials.getUsername()); char[] password = credentials.getPassword().getValue(); String userDN = (String) account.getAttribute(LDAPIdentityStore.ENTRY_DN_ATTRIBUTE_NAME).getValue(); if (CREDENTIAL_LOGGER.isDebugEnabled()) { CREDENTIAL_LOGGER.debugf("Using DN [%s] for authentication of user [%s]", userDN, credentials.getUsername()); } if (ldapIdentityStore.getOperationManager().authenticate(userDN, new String(password))) { return true; } return false; } }
private List<FileCredentialStorage> getCredentials(Account account, Class<? extends CredentialStorage> storageType) { Partition partition = account.getPartition(); FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, List<FileCredentialStorage>> agentCredentials = filePartition.getCredentials().get(account.getId()); if (agentCredentials == null) { agentCredentials = new ConcurrentHashMap<String, List<FileCredentialStorage>>(); this.fileDataSource.getPartitions().get(partition.getId()).getCredentials().put(account.getId(), agentCredentials); } List<FileCredentialStorage> credentials = agentCredentials.get(storageType.getName()); if (credentials == null) { credentials = Collections.synchronizedList(new ArrayList<FileCredentialStorage>()); } agentCredentials.put(storageType.getName(), credentials); return credentials; }
if (account.isEnabled()) { if (isDebugEnabled()) { CREDENTIAL_LOGGER.debugf("Account [%s] is ENABLED.", account, credentials);
private List<FileCredentialStorage> getCredentials(Account account, Class<? extends CredentialStorage> storageType) { Partition partition = account.getPartition(); FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, List<FileCredentialStorage>> agentCredentials = filePartition.getCredentials().get(account.getId()); if (agentCredentials == null) { agentCredentials = new ConcurrentHashMap<String, List<FileCredentialStorage>>(); this.fileDataSource.getPartitions().get(partition.getId()).getCredentials().put(account.getId(), agentCredentials); } List<FileCredentialStorage> credentials = agentCredentials.get(storageType.getName()); if (credentials == null) { credentials = Collections.synchronizedList(new ArrayList<FileCredentialStorage>()); } agentCredentials.put(storageType.getName(), credentials); return credentials; }