public static OwncloudModificationUser of(OwncloudUserDetails userDetails) {
    Validate.notNull(userDetails);

    OwncloudModificationUser modificationUser =
        OwncloudModificationUser.builder()
                                .username(userDetails.getUsername())
                                .password(userDetails.getPassword())
                                .enabled(userDetails.isEnabled())
                                .displayname(userDetails.getDisplayname())
                                .email(userDetails.getEmail())
                                .quota(userDetails.getQuota())
                                .build();
    Optional.of(userDetails)
            .map(OwncloudUserDetails::getAuthorities)
            .orElseGet(ArrayList::new)
            .stream()
            .map(GrantedAuthority::getAuthority)
            .forEach(modificationUser.groups::add);
    return modificationUser;
  }
public static OwncloudModificationUser of ( OwncloudUserDetails userDetails ) { Validate . notNull ( userDetails ) ; OwncloudModificationUser modificationUser = OwncloudModificationUser . builder ( ) . username ( userDetails . getUsername ( ) ) . password ( userDetails . getPassword ( ) ) . enabled ( userDetails . isEnabled ( ) ) . displayname ( userDetails . getDisplayname ( ) ) . email ( userDetails . getEmail ( ) ) . quota ( userDetails . getQuota ( ) ) . build ( ) ; Optional . of ( userDetails ) . map ( OwncloudUserDetails :: getAuthorities ) . orElseGet ( ArrayList :: new ) . stream ( ) . map ( GrantedAuthority :: getAuthority ) . forEach ( modificationUser . groups :: add ) ; return modificationUser ; }
Creates a new Instance by copying the Values of an existing {@link OwncloudUserDetails} Object.
<p/>
A {@link OwncloudUserDetails} Object will be returned by the
<code>OwncloudUserDetailsService.loadUserByUsername(String)</code> during
the Authentication Process of the
<code>OwncloudAuthenticationProvider.authenticate(org.springframework.security.core.Authentication)</code>
and resist as a {@link Principal} within the
{@link org.springframework.security.core.Authentication} Object (returned by
{@link org.springframework.security.core.Authentication#getPrincipal()}

@param userDetails
existing {@link OwncloudUserDetails} Object
@return new modifiable OwncloudUser Object