class UserAttributesConverter implements ToServerConverter<ClientAttribute, ProfileAttribute, ToServerConversionOptions>,
        ToClientConverter<ProfileAttribute, ClientAttribute, ToClientConversionOptions> {

    @Override
    public ClientAttribute toClient(ProfileAttribute serverObject, ToClientConversionOptions options) {
        ClientAttribute client = new ClientAttribute();
        client.setName(serverObject.getAttrName());
        if (serverObject.isSecure()) {
            client.setSecure(true);
        } else {
            client.setValue(serverObject.getAttrValue());
        }
        if (serverObject.getLevel() == ProfileAttributeLevel.PARENT) {
            client.setInherited(true);
        }
        if (isVisibleAttrHolder(serverObject)) {
            client.setHolder(recipientIdentityResolver.toRecipientUri(serverObject.getPrincipal()));
        }
        client.setDescription(serverObject.getDescription());

        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        String checkSecurityForAttrPath = attributePathTransformer.transformPath(serverObject.getPath(), authentication);
        InternalURI internalURI = new InternalURIDefinition(checkSecurityForAttrPath, PermissionUriProtocol.ATTRIBUTE);
        client.setPermissionMask(attributesPermissionService.getEffectivePermission(internalURI, authentication).getPermissionMask());

       return client;
    }

}