Giter Site home page Giter Site logo

Comments (2)

MikeyCarter avatar MikeyCarter commented on July 27, 2024

Interesting development. I downloaded your source into my program so I could play with the logging. It seems that if the password is valid... it sets it to null then says access denied. If the password is invalid it's access denied. If the password has special characters it's also denied.

Hard-code the password..... access works.

                LOGGER.info("1pass:"+password);
                password = "testpassword";
                if(password==null)
                    return PAM_CONV_ERR;

                LOGGER.info("2pass:"+password);

from libpam4j.

MikeyCarter avatar MikeyCarter commented on July 27, 2024

ok finally found the problem. Never fails I search at a problem but the minute I have to document it into an issue like this I find it.

So my problem was this:

            Collection<? extends GrantedAuthority> authorities = Collections.singleton(new SimpleGrantedAuthority("ROLE_USER"));
            return new UsernamePasswordAuthenticationToken(authentication.getPrincipal(), 
                                                           authentication.getCredentials(),
                                                           authorities);

vs

                                                           authentication.getCredentials());

Without the ROLES at the end it authenticates once fine (which I missed in the logs) then blanks out the password. Then tries a second attempt with a null password. Which is what I saw above. When it was a wrong password the thing would fail on first try.

So resolution... pay attention to the logs more closely. Posting here in case anyone else falls into the same trap but the issue can be closed.

from libpam4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.