@Test public void testAuthorize() { fields = new HashMap<String, Serializable>(); fields.put("accountid", "testaccount"); DefaultPrincipal currentPrincipal = new DefaultPrincipal("testaccount", null, null); ServiceActionContext currentContext = new ServiceActionContext(fields, currentPrincipal); sut.authorize(currentContext); }
@SuppressWarnings("unchecked") @Override public void authorize(final PrincipalActionContext inActionContext) throws AuthorizationException { Map<String, Serializable> inFields = (Map<String, Serializable>) inActionContext.getParams(); if (!inFields.containsKey(accountIdFieldKey)) { throw new AuthorizationException("Account key does not exist, failed to authorize."); } if (inActionContext.getPrincipal().getAccountId() .compareToIgnoreCase((String) inFields.get(accountIdFieldKey)) != 0) { throw new AuthorizationException("Insufficient permissions to update personal profile."); } }
IsFormSubmitterUserAuthorization implements AuthorizationStrategy<PrincipalActionContext> { @SuppressWarnings("unchecked") @Override public void authorize(final PrincipalActionContext inActionContext) throws AuthorizationException { Map<String, Serializable> inFields = (Map<String, Serializable>) inActionContext.getParams(); if (!inFields.containsKey(accountIdFieldKey)) { throw new AuthorizationException("Account key does not exist, failed to authorize."); } if (inActionContext.getPrincipal().getAccountId() .compareToIgnoreCase((String) inFields.get(accountIdFieldKey)) != 0) { throw new AuthorizationException("Insufficient permissions to update personal profile."); } } }
IsFormSubmitterUserAuthorization implements AuthorizationStrategy<PrincipalActionContext> { @SuppressWarnings("unchecked") @Override public void authorize(final PrincipalActionContext inActionContext) throws AuthorizationException { Map<String, Serializable> inFields = (Map<String, Serializable>) inActionContext.getParams(); if (!inFields.containsKey(accountIdFieldKey)) { throw new AuthorizationException("Account key does not exist, failed to authorize."); } if (inActionContext.getPrincipal().getAccountId() .compareToIgnoreCase((String) inFields.get(accountIdFieldKey)) != 0) { throw new AuthorizationException("Insufficient permissions to update personal profile."); } } IsFormSubmitterUserAuthorization(final String inAccountIdFieldKey); }
IsFormSubmitterUserAuthorization implements AuthorizationStrategy<PrincipalActionContext> { @SuppressWarnings("unchecked") @Override public void authorize(final PrincipalActionContext inActionContext) throws AuthorizationException { Map<String, Serializable> inFields = (Map<String, Serializable>) inActionContext.getParams(); if (!inFields.containsKey(accountIdFieldKey)) { throw new AuthorizationException("Account key does not exist, failed to authorize."); } if (inActionContext.getPrincipal().getAccountId() .compareToIgnoreCase((String) inFields.get(accountIdFieldKey)) != 0) { throw new AuthorizationException("Insufficient permissions to update personal profile."); } } IsFormSubmitterUserAuthorization(final String inAccountIdFieldKey); @SuppressWarnings("unchecked") @Override void authorize(final PrincipalActionContext inActionContext); }
IsFormSubmitterUserAuthorization implements AuthorizationStrategy<PrincipalActionContext> { @SuppressWarnings("unchecked") @Override public void authorize(final PrincipalActionContext inActionContext) throws AuthorizationException { Map<String, Serializable> inFields = (Map<String, Serializable>) inActionContext.getParams(); if (!inFields.containsKey(accountIdFieldKey)) { throw new AuthorizationException("Account key does not exist, failed to authorize."); } if (inActionContext.getPrincipal().getAccountId() .compareToIgnoreCase((String) inFields.get(accountIdFieldKey)) != 0) { throw new AuthorizationException("Insufficient permissions to update personal profile."); } } IsFormSubmitterUserAuthorization(final String inAccountIdFieldKey); @SuppressWarnings("unchecked") @Override void authorize(final PrincipalActionContext inActionContext);  }