Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section describes the usage of the User Information Recovery APIs in WSO2 Identity Server. Using the API there are two ways to recover a lost/forgotten password, i.e., by using email notifications or secret questions. Additionally it is also possible to retrieve the username if forgotten. See the following topics for more information on how to do all this.

...

  1. Enable the Identity Listener by setting the following property to true in the <IS_HOME>/repository/conf/identity/identity.xml file.

    Code Block
    languagexml
    <EventListener type="org.wso2.carbon.user.core.listener.UserOperationEventListener" name="org.wso2.carbon.identity.mgt.IdentityMgtEventListener" orderId="50" enable="true"/>
  2. Edit the identity­-mgt.properties file with the following configurations. This file is found in the <PRODUCT_HOME>/repository/conf/identity directory.

    Code Block
    languagejava
    Notification.Sending.Enable=true
    Notification.Expire.Time=3
    Notification.Sending.Internally.Managed=true
    UserAccount.Recovery.Enable=true
    Captcha.Verification.Internally.Managed=false

    See the following table for descriptions of these configurations.

    ConfigurationDescription
    Notification.Sending.Enable=true

    This enables the email sending function when recovering the account and verifying the user creation

    Notification.Expire.Time=3
    The time specified here is in minutes. In this case, the recovery expires after three minutes.
    Notification.Sending.Internally.Managed=true

    This enables the internal email sending module. If false, the email sending data is available to application via a Web service. Thus the application can send the email using its own email sender.

    UserAccount.Recovery.Enable=true
    This enables the user account recovery process.
    Captcha.Verification.Internally.Managed=false
    Set this to true if you do not have an existing captcha validation module.
  3. Ensure that the email-­admin-­config.xml file has the following configurations. This file is found in the <PRODUCT_HOME>/repository/conf/email directory. Use the email format with the type “passwordReset”.

    Code Block
    languagehtml/xml
    <configuration type="passwordReset">
    	<targetEpr></targetEpr>
    	<subject>Password Reset Notification</subject>
    	<body>
    		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:
    
    
    		https://localhost:8443/InfoRecoverySample/infoRecover/verify?confirmation={confirmation-code}&amp;userstoredomain={userstore-domain}&amp;username={user-name}&amp;tenantdomain={tenant-domain}
    
    		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.
    	</body>
    	<footer>
    		Best Regards,
    		WSO2 Carbon Team http://www.wso2.com
    	</footer>
    	<redirectPath></redirectPath>
    </configuration>

    The email sent to user includes the {confirmation-code}, which the Identity Server API caller needs to pass along with the user name.

  4. 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.

    Code Block
    languagehtml/xml
    <transportSender name="mailto"
    class="org.apache.axis2.transport.mail.MailTransportSender">
    	<parameter name="mail.smtp.from">sampleemail@gmail.com</parameter>
    	<parameter name="mail.smtp.user">sampleemail</parameter>
    	<parameter name="mail.smtp.password">password</parameter>
    	<parameter name="mail.smtp.host">smtp.gmail.com</parameter>
    	<parameter name="mail.smtp.port">587</parameter>
    	<parameter name="mail.smtp.starttls.enable">true</parameter>
    	<parameter name="mail.smtp.auth">true</parameter>
    </transportSender>

...

  1. Enter your username and password to log on to the Management Console.
  2. From the Main menu, click List under Claims.
  3. Click the WSO2 claim dialect (http://wso2.org/claims).
  4. You must select and configure three claim mappings. These are Challenge QuestionChallenge Question1 and Challenge Question2.
    Image Modified

    The following are the three claims necessary. For each claim URI below, there should be one claim mapping.
    • http://wso2.org/claims/challengeQuestionUris 
    • http://wso2.org/claims/challengeQuestion1 
    • http://wso2.org/claims/challengeQuestion2
  5. For the mapped attribute, provide any attribute that your underlying user store supports. This example keeps the defaults as they are. The three claims are set as ‘Supported by Default’ so that these attributes will appear in the user’s profile when viewing from the management console.
    The following table lists out how these claims are used.
    Claim URIDescription
    http://wso2.org/claims/challengeQuestionUris

    This claim holds the claim URIs of the challenge question sets associated with the user’s profile. If the user has challenge question 1 and 2 set, the value will be all the associated claims separated by the ! mark. For example, http://wso2.org/claims/challengeQuestion1!http://wso2.org/claims/challengeQuestion2

    http://wso2.org/claims/challengeQuestion1

    This claim holds the details of the first challenge question of the user. Here the claim value will contain the question and the answer. The answer is a hashed value and not in plain text. For example, Favorite sport ?!jyf0Mvy6pLUYChzHqPoWapPNo8G85vGZIt1RnQL0uzk=

    http://wso2.org/claims/challengeQuestion2This claim holds the details of the second challenge question of the user. Here the claim value will contain the question and the answer. The answer is a hashed value and not in plain text. For example, Favorite food ?!IJ92QY7OfJNrZf9Hd6V42GD3YsN61sfwj1gmJCGZ71E=

    Now the required claim mappings for challenge questions feature are set.

...

  1. On the Main tab in the Management Console, click List under Users and Roles.
  2. Click Users. This link is only visible to users with the Admin role. 
  3. Click User Profile next to the user you created.
  4. You can see that the challenge question values are set for this user.