package com.kryptnostic.directory.v1.principal;

import java.util.Set;
import java.util.UUID;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.base.Optional;
import com.kryptnostic.kodex.v1.constants.Names;
import com.kryptnostic.kodex.v1.models.UserAttributes;

/**
 * Interface for user principals
 *
 * @author Matthew Tamayo-Rios &lt;matthew@kryptnostic.com&gt;
 */
@JsonSerialize(
    as = User.class )
public interface User extends Principal {
    @JsonProperty( Names.USERNAME_FIELD )
    String getName();

    @Deprecated
    @JsonProperty( Names.REALM_FIELD )
    String getRealm();

    @JsonProperty( Names.DOMAIN_FIELD )
    String getDomain();

    @Nonnull
    @JsonProperty( Names.EMAIL_FIELD )
    String getEmail();

    @Nonnull
    @JsonProperty( Names.CERTIFICATE_FIELD )
    byte[] getCertificate();

    @Nonnull
    @JsonProperty( Names.ROLES_FIELD )
    Set<String> getRoles();

    @Nonnull
    @JsonProperty( Names.GROUPS_PROPERTY )
    Set<UUID> getGroups();

    @Nonnull
    @JsonProperty( Names.VERSION_FIELD )
    int getUserVersion();

    @JsonProperty( Names.ATTRIBUTES_FIELD )
    UserAttributes getAttributes();

    @Nullable
    @JsonIgnore
    Optional<String> getGivenName();

    @Nullable
    @JsonIgnore
    Optional<String> getFamilyName();

    Optional<Object> getAttribute( String key );
}

@@ -262,16 +262,82 @@
 operty;%0A
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;%0A
 import c
@@ -384,32 +384,32 @@
 .JsonSerialize;%0A
-
 import com.googl
@@ -481,16 +481,72 @@
 .Names;%0A
+import com.kryptnostic.kodex.v1.models.KryptnosticUser;%0A
 import c
@@ -716,16 +716,16 @@
 ialize(%0A
-
     as =
@@ -738,16 +738,67 @@
 class )%0A
+@JsonDeserialize(%0A    as = KryptnosticUser.class )%0A
 public i

Fix user deserialization.?