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

    https://github.com/apache/syncope/pull/70#discussion_r181103559
  
    --- Diff: 
core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAccessTokenDAO.java
 ---
    @@ -115,6 +115,16 @@ public AccessToken save(final AccessToken accessToken) 
{
             return entityManager().merge(accessToken);
         }
     
    +    @Override
    +    public AccessToken replace(final AccessToken accessToken) {
    +        AccessToken existing = findByOwner(accessToken.getOwner());
    +        if (existing != null) {
    +            delete(existing.getKey());
    +        }
    +
    +        return save(accessToken);
    --- End diff --
    
    `return replaceExisting ? save(accessToken) : existing;`


---

Reply via email to