You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@syncope.apache.org by Sarris Overbosch | Everett <sa...@everett.nl> on 2012/05/15 14:12:49 UTC

Question about the username and why it cannot be empty.

Hi,

I'm currently busy migrating to 0.7.1 version and the web application we
build to register user, which works against the previous version of
Syncope, is not working anymore. The cause is that in the SyncopeUser
object the username cannot be null, we don't provide a username as we
don't want the user to be able to log in to the console. (We use the
rest interface)

What bothers me the most is the exception which is thrown, this is it:

SEVERE: Servlet.service() for servlet [syncope-core-rest] in context
with path [/syncope] threw exception [Request processing failed; nested
exception is
org.syncope.core.persistence.validation.entity.InvalidEntityException:
SyncopeUser [username: may not be null]] with root cause
org.syncope.core.persistence.validation.entity.InvalidEntityException:
SyncopeUser [username: may not be null]
        at
org.syncope.core.persistence.validation.entity.EntityValidationInterceptor.save(EntityValidationInterceptor.java:59)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

I would have expected this problem to be noticed before the actual
persist action (but that's just me)

The actual question I have is, why can't the username be empty?  (I can
work around this problem by using some other unique information from the
user, but I'm just curious to the why question)

Br,

Sarris

Re: Question about the username and why it cannot be empty.

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 15/05/2012 14:12, Sarris Overbosch | Everett wrote:
> Hi,
>
> I'm currently busy migrating to 0.7.1 version and the web application we build to register user, which works against the previous version of Syncope, is not working anymore. The cause is that in the SyncopeUser
> object the username cannot be null, we don't provide a username as we don't want the user to be able to log in to the console. (We use the rest interface)
>
> What bothers me the most is the exception which is thrown, this is it:
>
> SEVERE: Servlet.service() for servlet [syncope-core-rest] in context with path [/syncope] threw exception [Request processing failed; nested exception is
> org.syncope.core.persistence.validation.entity.InvalidEntityException:
> SyncopeUser [username: may not be null]] with root cause
> org.syncope.core.persistence.validation.entity.InvalidEntityException:
> SyncopeUser [username: may not be null]
>         at
> org.syncope.core.persistence.validation.entity.EntityValidationInterceptor.save(EntityValidationInterceptor.java:59)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> I would have expected this problem to be noticed before the actual persist action (but that's just me)

Hi Sarris,
since its very early days, Syncope validates each JPA entity (using one
of available Bean Validation Spec JST 303 implementations - currently
Apache BVal) during merge on the EntityManager context: an invalid
entity against the specified constraint will cause the underlying
transaction to rollback.
AFAIK this is in line with the above mentioned specification.

> The actual question I have is, why can't the username be empty?  (I can work around this problem by using some other unique information from the user, but I'm just curious to the why question)

Probably the main reason is that username is required for users to
authenticate to RESTful services, (including admin console): in the
past, as you know, user id was used for such purpose, but we changed
that in 0.7.X.

Regards.

-- 
Francesco Chicchiriccò

Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/