Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/70#discussion_r181093708
  
    --- Diff: 
core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AccessTokenDataBinderImpl.java
 ---
    @@ -135,11 +135,7 @@
                     accessToken.setAuthorities(authorities);
                 }
     
    -            accessTokenDAO.save(accessToken);
    -        }
    -
    -        if (replaceExisting && existing != null) {
    -            accessTokenDAO.delete(existing);
    +            accessTokenDAO.merge(accessToken);
    --- End diff --
    
    So, the current implementation will replace the token only if 
`replaceExisting` is true; with your change, the token will be replaced anyway, 
because `JPAAccessTokenDAO#merge` will do
    
    ```
    if (existing != null) {
                entityManager().remove(existing);
            }
    ```
    while the current code does
    ```
            if (replaceExisting && existing != null) {
                accessTokenDAO.delete(existing);
            }
    ```


---

Reply via email to