Search in sources :

Example 1 with StandardPinInfo

use of net.phonefactor.pfsdk.StandardPinInfo in project cas by apereo.

the class AzureAuthenticatorAuthenticationRequestBuilder method build.

/**
     * Build pf auth params.
     *
     * @param p the principal
     * @param c the credential/token
     * @return the pf auth params
     */
public PFAuthParams build(final Principal p, final AzureAuthenticatorTokenCredential c) {
    if (!p.getAttributes().containsKey(this.phoneAttributeName)) {
        throw new IllegalArgumentException(this.phoneAttributeName + " is not available as a principal attribute");
    }
    final PFAuthParams params = new PFAuthParams();
    params.setPhoneNumber(p.getAttributes().get(this.phoneAttributeName).toString());
    params.setCountryCode("1");
    params.setUsername(p.getId());
    switch(mode) {
        case PIN:
            params.setAuthInfo(new PlainTextPinInfo(c.getToken()));
            break;
        case POUND:
        default:
            params.setAuthInfo(new StandardPinInfo());
    }
    return params;
}
Also used : StandardPinInfo(net.phonefactor.pfsdk.StandardPinInfo) PFAuthParams(net.phonefactor.pfsdk.PFAuthParams) PlainTextPinInfo(net.phonefactor.pfsdk.PlainTextPinInfo)

Aggregations

PFAuthParams (net.phonefactor.pfsdk.PFAuthParams)1 PlainTextPinInfo (net.phonefactor.pfsdk.PlainTextPinInfo)1 StandardPinInfo (net.phonefactor.pfsdk.StandardPinInfo)1