Uploaded image for project: 'AdMaxLocal'
  1. AdMaxLocal
  2. AML-4130

Unable to create new user for the realm if we had previously entered duplicate email address

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Mercury
    • Fix Version/s: Mercury
    • Component/s: API
    • Labels:
      None
    • Environment:

      QA 7

      aml-oauth-provider-1.0.2-RC1.war
      qos-service-1.0.2-RC1.war

    • Sprint:
      Sprint 24

      Description

      1.Onboarded new realm

      groovy onboard.groovy -d TRACE -h aml-qa7-front1 -l 8080 -u admin+tsa@thesearchagency.com -p admin -r thesearchagency -rr amlmercury -rbu http://amlmercury.aml-qa7-front1:8080/reseller/ -ru http://www.mercury.com -rm 0 -rmin 1.00 -rtz Asia/Tokyo -rdn "AML yjptesting apollo" -rp 1234567894 -rcn "mercurytesting" -rcp 1234567890 -rce atul.sanagaraml@gmail.com -rcc JPY -rpn "AML Mercury Test" -rl ja_JP -rsp "1-800-HELP" -mdt "AML Fuji" -mde true -rg ja -tu http://termsofservicelink.com -pu http://privacylink.com -rcd JP

      2.Login to AML User Management

      3.Enter duplicate email address of the existing users
      Ex. atul.sanagar@thesearchagency.com (Admin User) for realm "thesearchagency"

      4.It shows message ,"something wrong ....please contact administrator"
      Tomcat throws exception

      Snippet of tomcat log:

      {Detailed log attached}

      Headers:

      {Accept=[application/json, text/javascript, */*; q=0.01], accept-encoding=[gzip, deflate], accept-language=[en-US,en;q=0.5], connection=[Keep-Alive], Content-Length=[105], content-type=[application/json], cookie=[JSESSIONID=F218A2BE4925F365CB454B28C48BECDD], host=[localhost:7733], referer=[http://localhost:7733/aml-oauth-provider/], user-agent=[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0], x-csrf-token=[0eabff81-558c-4c82-8bf2-ce192d23545a], x-forwarded-host=[localhost:7733], x-forwarded-server=[2001:4800:7810:512:be76:4eff:fe04:c432], x-requested-with=[XMLHttpRequest]}

      Payload:

      {"username":"atul.sanagar@thesearchagency.com","roles":["ROLE_USER"],"realm":"amlmercury","enabled":true}

      --------------------------------------
      2016-05-10 15:18:41 WARN org.apache.cxf.phase.PhaseInterceptorChain:452 - admin REALM_thesearchagency, ROLE_ADMIN, ROLE_USER - Application

      {http://cxf.services.provider.oauth2.admaxlocal.com/}

      UserService has thrown exception, unwinding now
      org.apache.cxf.interceptor.Fault: PreparedStatementCallback; SQL [INSERT INTO users (username, password, enabled) VALUES (?,?,?)]; Duplicate entry 'atul.sanagar@thesearchagency.com' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'atul.sanagar@thesearchagency.com' for key 'PRIMARY'
      at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:163)
      at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:129)
      at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)
      at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
      at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
      .
      .
      .
      Caused by: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO users (username, password, enabled) VALUES (?,?,?)]; Duplicate entry 'atul.sanagar@thesearchagency.com' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'atul.sanagar@thesearchagency.com' for key 'PRIMARY'
      at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:245)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
      at org.springfra

      mysql> select * from sapi_users;
      -----------------------------------------------------------------------------------------------------+

      realm username password uuid

      -----------------------------------------------------------------------------------------------------+

      thesearchagency admin+tsa@thesearchagency.com admin NULL
      apollo amlExternalApi@admaxlocal.com 6110b27324dd4aa6AML c227de22-3b6a-45ff-a6c7-4bf81cce4db9
      yjapollo amlExternalApi@admaxlocal.com ff81a57179a64398AML a7cf226d-a71c-4a31-83e3-ea51fd1e61a5
      mercury amlExternalApi@admaxlocal.com 19cc57f92fc54bcaAML 2f7cc3a1-ff25-4fd5-b174-095dba4bdbf4
      amlmercury amlExternalApi@admaxlocal.com 3b2781b6c6394943AML 060f66ad-fe83-4f4c-b0fa-d604d9733eaa

      -----------------------------------------------------------------------------------------------------+
      5 rows in set (0.00 sec)

      5.Now try to create with different user for this realm

      Actual result:

      It shows message,"A user already exists for that realm.Please use the existing user."

      Expected result:

      On duplicate email address when creating user first time, it should not be added to DB so that we can create new user with different email address.

        Attachments

          Activity

            People

            • Assignee:
              atul.sanagar Atul Sanagar (Inactive)
              Reporter:
              atul.sanagar Atul Sanagar (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: