Class TelekomSMSTokenProvider

All Implemented Interfaces:
TokenProvider

public class TelekomSMSTokenProvider extends SMSTokenProvider
Description

The telekomSMSTokenProvider randomly generates a 6-digit token after the user entered her correct password.

The token is then sent to the user via text message. The user's attribute sms is used as the recipient phone number. If this attribute has not been provided by the user data provider, the login attempt fails.

The text message is sent via Deutsche Telekom's developer garden REST API. To use this API, a registered user account with sufficient balance is necessary and the Send SMS API has to be enabled for this account. Membrane API Gateway must be registered as an "application" on the developer garden website, and the "Global SMS API" must be enabled both for the user account as well as the registered application. Once completed, the scope, clientId and clientSecret settings must be copied from the website into Membrane's proxies.xml configuration file. Membrane uses these three parameters to identify itself when connecting to the Telekom API Gateway.

When using a non-standard environment (see https://www.developergarden.com/apis/documentation/bundle/telekom-api-rest/html/sendsms.html#environmental_infos for more information), the parameters senderName and senderAddress may be used to set the SMS sender address and name.

The token is prepended by prefixText to generate the text message's text.

If normalizeTelephoneNumber is set, the user's sms attribute will be normalized according to the following rules before using it:

  • '+' is replaced by '00'.
  • Any characters within round brackets, '(' and ')', are removed.
  • '-' and ' ' are removed.

Explanation
A token provider using Deutsche Telekom's REST interface developer garden to send a randomly generated numeric token to the user via text message.
  • Constructor Details

    • TelekomSMSTokenProvider

      public TelekomSMSTokenProvider()
  • Method Details

    • init

      public void init(Router router)
    • normalizeNumber

      protected String normalizeNumber(String number)
      Specified by:
      normalizeNumber in class SMSTokenProvider
    • sendSMS

      protected void sendSMS(String text, String recipientNumber)
      Specified by:
      sendSMS in class SMSTokenProvider
    • getScope

      public String getScope()
    • setScope

      public void setScope(String scope)
      Description
      The scope assigned to you by developergarden.com .
    • getClientId

      public String getClientId()
    • setClientId

      public void setClientId(String clientId)
      Description
      The clientId assigned to you by developergarden.com .
    • getClientSecret

      public String getClientSecret()
    • setClientSecret

      public void setClientSecret(String clientSecret)
      Description
      The clientSecret assigned to you by developergarden.com .
    • getSenderName

      public String getSenderName()
    • setSenderName

      public void setSenderName(String senderName)
      Description
      The sender name of the text messages. May only be set, if you are a member of the premium program on developergarded.com .
    • getSenderAddress

      public String getSenderAddress()
    • setSenderAddress

      public void setSenderAddress(String senderAddress)
      Description
      The sender address (telephone number) of the text messages. May only be set, if you are a member of the premium program on developergarded.com .
    • getEnvironment

      public TelekomSMSTokenProvider.EnvironmentType getEnvironment()
    • setEnvironment

      public void setEnvironment(TelekomSMSTokenProvider.EnvironmentType environment)
      Default
      budget
      Description
      The environment (program name) you are paying for on developergarden.com .
      Example
      premium