netzbegruenung / keycloak-mfa-plugins

Keycloak Authentication Provider implementation to get a 2nd-factor authentication with a OTP/code/token send via SMS
Apache License 2.0
42 stars 9 forks source link

Use Lib Phonenumber #85

Open alexanderhofstaetter opened 1 week ago

alexanderhofstaetter commented 1 week ago

It would be great to autoformat the number with https://github.com/google/libphonenumber and reject everything which is not type=mobile. Also the nunber format can be normalized with this.

svenseeberg commented 4 days ago

Rejecting mobile numbers would have to be an optional setting, I think. In many cases land lines will probably work as some providers automatically create a phone call and read the SMS text. See also https://github.com/netzbegruenung/keycloak-mfa-plugins/issues/21

alexanderhofstaetter commented 4 days ago

maybe add a config option to optionally add a "number type filter" -> add a comma seperated list of options which are valid:

see: https://github.com/google/libphonenumber/blob/b75f2937daea4e6a67cb91de7325061938df37bd/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/Types.java#L22

so I would like to add a filter: MOBILE, FIXED_LINE_OR_MOBILE, PAGER

when the filter is empty -> current behaviour stays the same

or optionally, there is a function for this: https://github.com/google/libphonenumber/blob/b75f2937daea4e6a67cb91de7325061938df37bd/java/carrier/src/com/google/i18n/phonenumbers/PhoneNumberToCarrierMapper.java#L117