Issue#83

This pull request should address the refactoring for allowing the implementation to rank and select the mfa method to branch to by comparing the current requested ranked one (the current mfa transaction) with any previously fulfilled mfa authentications for the current CAS SSO session.

The only user-facing configuration change is the wiring of the existing mfa ranking configuration Map into the `OrderedMfaMethodRankingStrategy` bean like so:

```xml
<bean id="authenticationMethodRankingStrategy" class="net.unicon.cas.mfa.authentication.OrderedMfaMethodRankingStrategy"
          c:mfaRankingConfig-ref="supportedAuthenticationMethodsConfig"/>
```
My point of view - verifier API happens at the different point in the execution flow and does its thing before the execution gets to this point. At this point the requested mfa has been verified and passed. This piece of code here is the internal implementation detail that has nothing to do with the externally requested mfa method verification and is just a "courtesy paranoia check" for the misconfigured mfa ranking map - which is a singleton used throughout the components anyway. 


So, I personally accept a little bit of redundancy here in one place of this internal implementation. Or we could get rid of this check altogether anyway - as this in theory should never happen in practice :-)




D.
—
Sent from Mailbox

On Tue, Aug 5, 2014 at 2:48 AM, Misagh Moayyed <notifications@github.com>
wrote:

>> +
>> +    @Override
>> +    public boolean anyPreviouslyAchievedAuthenticationMethodsStrongerThanRequestedOne(final Set<String> previouslyAchievedAuthenticationMethods,
>> +                                                                                      final String requestedAuthenticationMethod) {
>> +
>> +        Assert.notNull(previouslyAchievedAuthenticationMethods);
>> +        Assert.notNull(requestedAuthenticationMethod);
>> +
>> +        if (previouslyAchievedAuthenticationMethods.isEmpty()) {
>> +            return false;
>> +        }
>> +
>> +        final Integer currRank = this.mfaRankingConfig.get(requestedAuthenticationMethod);
>> +        //Treat this as misconfiguration and throw a RuntimeException
>> +        if (currRank == null) {
>> +            throw new RuntimeException("The [mfaRankingConfig] Map is mis-configured. It does not have a ranking value mapping for the"
> Well, you have got two different behaviors here for the same thing, not to mention extra checks for something that is already take care of by the verifier. Anything that has to do with checking authn methods should be delegated to an instance of `AuthenticationMethodVerifier`
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/Unicon/cas-mfa/pull/84/files#r15797206