Get into two issues when using cas-server-support-authy module

26 views
Skip to first unread message

陈荣俊

unread,
Apr 6, 2017, 5:21:51 AM4/6/17
to cas-...@apereo.org

Dear community,

 

Recently I am working on a MFA project for my client by integrating CAS with Authy. I am on the version 5.0.4. I have got into two issues during this process.

 

Please check my configuration attached.

 

The first issue is that a NullPointerException occurs at supports() of AbstractMultifactorAuthenticationProvider. The bypassEvaluator is null, which causes the exception. I try to add a null check to get around this to go ahead with the PoC at the moment.

 

The second issue is the user not valid exception during createUser in AuthyClientInstance. Actually, I am using an Chinese phone number but the country code is always default to the DEFAUT_COUNTRY_CODE which is “1”. If I parse the phone number and try to create user with the country code, I am able to finish the authentication.

 

    public User getOrCreateUser(final Principal principal) {

        final String email = (String) principal.getAttributes().get(this.mailAttribute);

        if (StringUtils.isBlank(email)) {

            throw new IllegalArgumentException("No email address found for " + principal.getId());

        }

        final String phone = (String) principal.getAttributes().get(this.phoneAttribute);

        if (StringUtils.isBlank(phone)) {

            throw new IllegalArgumentException("No phone number found for " + principal.getId());

        }

        PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();

        PhoneNumber phoneNumber;

            try {

                  phoneNumber = phoneUtil.parse(phone, Users.DEFAULT_COUNTRY_CODE);

            } catch (NumberParseException e) {

                  throw new IllegalArgumentException("Invalid phone number found for " + principal.getId());

            }

        return this.authyUsers.createUser(email, phoneNumber.getNationalNumber() + "", phoneNumber.getCountryCode() + "");

}

 

Are these issues are reported before? Or are there any other official ways to handle this?

 

Thanks,

cas.properties
Reply all
Reply to author
Forward
0 new messages