Import error br.gov.frameworkdemoiselle.security.User

Asked

Viewed 641 times

1

Error importing the interface User:

import br.gov.frameworkdemoiselle.security.User;

Version of Demoiselle used: 2.5.0-RC1

According to Grepcode, in version 2.5.0-BETA2, this interface existed (http://grepcode.com/file/repo1.maven.org/maven2/br.gov.frameworkdemoiselle/demoiselle-core/2.5.0-BETA2/br/gov/frameworkdemoiselle/security/User.java?av=f), but from 2.5.0-BETA3 onwards, it disappeared (http://grepcode.com/project/repo1.maven.org/maven2/br.gov.frameworkdemoiselle/demoiselle-core/).

Does anyone know which interface replaces 'User' ?

I’m implementing the interface Authenticator:

import br.gov.frameworkdemoiselle.security.Authenticator;
import br.gov.frameworkdemoiselle.security.User;

public class Autenticador implements Authenticator {
    ...
    @Override
    public User getUser() {
        return new User() {
            private static final long serialVersionUID = 1L;

            @Override
            public void setAttribute(Object arg0, Object arg1) {

            }

            @Override
            public String getId() {
                return "usuario X";
            }

            @Override
            public Object getAttribute(Object arg0) {
                return null;
            }
        };
    }

}

1 answer

1

This interface has been discontinued and instead we recommend using java.security.Home which makes the solution more compatible with other Java standards such as JAAS for example.

Remembering that Demoiselle 2.5 is not yet in the final version, while we are testing in the example application: https://github.com/demoiselle/laboratory/tree/master/estacionamento/v25X

ex:

....

@Override
public  Principal getUser() {

    if (authenticated) {

        return new Principal() {

            @Override
            public String getName() {
                return credentials.getUsername();
            }

        };
    }else{
        return null;
    }

}

@Override
public void unauthenticate() throws Exception {
    credentials.clear();
    authenticated = false;
}
  • Version 2.5.0 has been released.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.