This documentation is for WSO2 Identity Server 5.0.0. View documentation for the latest release.
Recover with Notification - Identity Server 5.0.0 - WSO2 Documentation
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

WSO2 Identity Server supports password recovery by using email-based notifications. The following describes the configurations needed to send email using axis transport with the Identity Server with regard to password recovery.

To recover with notification:

  1. Edit the identity­ file with the following configurations. This file is found in the <PRODUCT_HOME>/repository/conf/security directory.

    Notification.Expire.Time=3 # expire the recovery after 3 minutes.
    Captcha.Verification.Internally.Managed=false # set this to true if you do not have existing captcha validation module
  2. Edit the email-­admin-­config.xml file with the following configurations. This file is found in the <PRODUCT_HOME>/repository/conf/email directory. Define a email format with the type “passwordReset”.

    <configuration type="passwordReset">
    	<subject>Password Reset Notification</subject>
    		Hi {first-­name}
    		We received a request to change the password on the {user-­name} account
    		associated with this e­mail address. If you made this request, please click
    		the link below to securely change your password:
    		If clicking the link doesn't seem to work, you can copy and paste the link
    		into your browser's address window.
    		If you did not request to have your {user-­name} password reset, simply
    		disregard this email and no changes to your
    		account will be made.
    		Best Regards,
    		WSO2 Carbon Team

    The email sent to user includes the {password-­reset-­link} replaced with the URL defined within the targetEprtag appending the confirmation={key} which the Identity Server API caller needs to pass along with the user name.

  3. Edit the axis.xml file with the following configuration. This file is found in the <PRODUCT_HOME>/repository/conf/axis2/ directory. Uncomment the following in the file and provide the necessary email settings.

    <transportSender name="mailto"
    	<parameter name="mail.smtp.from"></parameter>
    	<parameter name="mail.smtp.user"></parameter>
    	<parameter name="mail.smtp.password">password</parameter>
    	<parameter name=""></parameter>
    	<parameter name="mail.smtp.port">587</parameter>
    	<parameter name="mail.smtp.starttls.enable">true</parameter>
    	<parameter name="mail.smtp.auth">true</parameter>

Recovering the password with email notification can be achieved using the exposed UserInformationRecoveryService where the WSDL can be found in the following URL of your Identity Server installation: https://localhost:9443/services/UserInformationRecoveryService?wsdl.

The service security is implemented using Captcha and confirmation codes expire after a while. Also for each communication, the generated confirmation code is not reused by the service. This makes the services secure and fails repeated attempts to access the same service. Hence, the sequence of calls that the calling application must do is as follows for email-based recovery:

  1. getCaptcha() -­ Generates a captcha.
  2. verifyUser() -­ Validates the captcha answer and username and returns a new key.
  3. sendRecoveryNotification() -­ Send an email notification with a confirmation code to the user. Need to provide the key from previous call.
  4. getCaptcha() ­- Generates a captcha when the user clicks on the URL.
  5. verifyConfirmationCode() -­ Validates the captcha answer and confirmation code. This returns a key.
  6. updatePassword() -­ Updates the password in the system. Need to provide the key from previous call, new password and returns the status of the update, true or false.

The flow of password recovery by email notification is as follows using the WSDL file (https://localhost:9443/services/UserInformationRecoveryService?wsdl). First you need to get the captcha using the getCaptcha() method. The captcha details returned should be passed along with the visible captcha answer and user name to verifyUser() which is for user verification. Upon successful verification, it will return a code. Then you need to call the sendRecoveryNotification() method to send the notification along with the code to the user. The generated email with the password reset link will be emailed to the user. Once the user clicks the reset link, the user should be directed to another captcha page for verification by calling getCaptcha(). The confirmation code must be verified along with the captcha answer by calling verifyConfirmationCode(). This will generate another code that must be passed to the updatePassword() method to update the password.

You can find a sample of this from here. You can follow the “I forgot my password” link to see the demo.

  • No labels