Отправка электронного письма пользователю для проверки с помощью WSO2

Я совершенно новичок в wso2. Я пытаюсь отправить электронное письмо пользователю для проверки новой учетной записи, которую я (администратор) создаю для определенной компании (не через gmail) в ОСНОВНОМ домене по умолчанию. Используя эту ссылку, они должны иметь возможность войти в систему и установить новый пароль. Для этого я выполнил следующие шаги:

(1) Настройка файла identity-mgt.properties

# Identity listener is enable

Identity.Listener.Enable=true

# Enable email sending function when recovering the account and verifying the user creation

Notification.Sending.Enable=true
Notification.Expire.Time=7200

# Enable internal email sending module. If "false", email sending data would be available to application via webservice. Then application can send the email using its own email sender 

Notification.Sending.Internally.Managed=true

# Enable verification of account creation. When self registration is done,  user would be verified by sending email (confirmation link) to user's email account
 
UserAccount.Verification.Enable=true

UserAccount.Recovery.Enable=false


# Whether user can do the verification or not. If value is defined for role, Then the email is sent to users that have been assigned to this role. Not for the user who is registered.

UserAccount.Verification.Role=

# Whether captcha verification is done by identity server or application level

Captcha.Verification.Internally.Managed=true

# Whether temporary password are used when creating users or recovering accounts

Temporary.Password.Enable=false
Temporary.Password.Default.Value=password
Temporary.Password.OneTime=false
Temporary.Password.Expire.Time=0

# Enable authentication rules other than password check 

Authentication.Policy.Enable=true

# Enable following checking on authenication.  By default account lock check is enable 

Authentication.Policy.Check.Account.Exist=false 
Authentication.Policy.Check.Account.Lock=false
Authentication.Policy.Check.OneTime.Password=false
Authentication.Policy.Check.Password.Expire=false

# Configuration to build an authentication policy

Authentication.Policy.Password.Expire.Time=0
# If account verification is not enabled, following property will decide where user must be lock or not after user is created 
Authentication.Policy.Account.Lock.On.Creation=false
Authentication.Policy.Account.Lock.Time=0
Authentication.Policy.Account.Lock.On.Failure=false
Authentication.Policy.Account.Lock.On.Failure.Max.Attempts=0

# Define pluggable extension points

Identity.Mgt.Random.Password.Grenerator=org.wso2.carbon.identity.mgt.password.DefaultPasswordGenerator
Identity.Mgt.User.Data.Store=org.wso2.carbon.identity.mgt.store.UserStoreBasedIdentityDataStore
Identity.Mgt.Notification.Sending.Module.1=org.wso2.carbon.identity.mgt.mail.DefaultEmailSendingModule
Identity.Mgt.User.Recovery.Data.Store=org.wso2.carbon.identity.mgt.store.RegistryRecoveryDataStore


# Define password policy enforce extensions

Password.policy.extensions.1=org.wso2.carbon.identity.mgt.policy.password.DefaultPasswordLengthPolicy
Password.policy.extensions.1.min.length=6
Password.policy.extensions.1.max.length=12
Password.policy.extensions.2=org.wso2.carbon.identity.mgt.policy.password.DefaultPasswordNamePolicy
Password.policy.extensions.3=org.wso2.carbon.identity.mgt.policy.password.DefaultPasswordPatternPolicy
Password.policy.extensions.3.pattern=^((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%&*])).{0,100}$

(2) Настройка файла axis2.xml.... В этом я раскомментировал раздел transportSender name=mailto и добавил значения параметров. Я также раскомментировал раздел transportReceiver name=mailto. Параметры в разделе transportSender name=mailto:

<transportSender name="mailto"
                     class="org.apache.axis2.transport.mail.MailTransportSender">
        <parameter name="mail.smtp.from"></parameter>
        <parameter name="mail.smtp.user"></parameter>
        <parameter name="mail.smtp.password"></parameter>
        <parameter name="mail.smtp.host"></parameter>

        <parameter name="mail.smtp.port"></parameter>
        <parameter name="mail.smtp.starttls.enable"></parameter>
        <parameter name="mail.smtp.auth"></parameter>
    </transportSender>

(3) Это настройка по умолчанию для некоторой части файла email-admin-config.xml.

<configuration type="askPassword">
  <targetEpr></targetEpr>
  <subject>WSO2 Carbon - Password Change for New Account</subject>
  <body>
Hi {first-name}

Please change your password for the newly created account : {user-name}. Please click the link below to create the password.

http://localhost:9443/InfoRecoverySample/infoRecover/verify?confirmation={confirmation-code}

If clicking the link doesn't seem to work, you can copy and paste the
link into your browser's address window.
  </body>
  <footer>
Best Regards,
WSO2 Carbon Team
http://www.wso2.com
  </footer>
  <redirectPath></redirectPath>
</configuration>

Теперь, когда я создаю нового пользователя, выбрав опцию «Запросить пароль», я получаю эту ошибку. Но пользователь создается в домене по умолчанию.

Не удалось добавить пользователя PRIMARY/addUser. Ошибка: Ошибка при выполнении doPostAddUser

Я искал полный процесс на многих сайтах, но не получил надлежащей документации относительно того, что делает каждый параметр в разных файлах, чтобы настроить его для моего использования.

Пожалуйста, дайте мне знать, где я ошибся, а также какие другие вещи мне нужно настроить. Также источники необходимы для понимания всех параметров.

Заранее спасибо.


person Sherry    schedule 11.07.2014    source источник


Ответы (2)


я должен был добавить

-Djava.net.preferIPv4Stack=true 

в сценарии wso2server.

Отправка почты работала как часы

person wsrevival    schedule 18.02.2015

Убедитесь, что для следующего параметра установлено значение false в repository\conf\security\identity-mgt.properties:

Authentication.Policy.Account.Lock.On.Creation=false
person Newuser    schedule 16.02.2015
comment
После mail.wso2.org/mailarchive/dev/2014-December/040210 .html я добавил следующее сопоставление утверждений: Описание: Идентификация, пароль, отметка времени, Uri утверждения: wso2.org /claims/identity/passwordTimestampMapped Атрибут: facsimileTelephoneNumber Кажется, возникла проблема (ошибка?) с пользовательским интерфейсом: значение атрибута содержит null только после создания сопоставления, и мне пришлось изменить сопоставление и перезаписать null с помощью facsimileTelephoneNumber После этого процесс создания работал хорошо - person Newuser; 16.02.2015