예제 #1
0
  @Test
  public void verifyPasswordAsAuthenticationAttributeCanDecrypt() throws Exception {
    final Map<?, ?> attributes = renderView();
    assertTrue(attributes.containsKey(CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL_CREDENTIAL));

    final String encodedPsw =
        (String) attributes.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL_CREDENTIAL);
    final String password = decryptCredential(encodedPsw);
    final UsernamePasswordCredential creds =
        org.jasig.cas.authentication.TestUtils.getCredentialsWithSameUsernameAndPassword();
    assertEquals(password, creds.getPassword());
  }