Problem to get a user logged in

Hi at all,

I have just started to use Flow (3.0) for building a native app with it.
Unfortunately I got stuck at a very fundamental piece of the app: the user login.

I have already consulted the Definitive Guide (and think I have basically followed its advice) but I can’t log in with my test user.
As the new Flow version has renewed parts of the security component even the few existing tutorials and code snippets could not really help me.

So, this is roughly my code:
https://gist.github.com /anonymous/8c6bedce81801e072dd0 (please remove the blank space. I am not allowed to post that url as a new forum user… :frowning: )

When I try to call dev.project.localhost/acme.project/standard/secured I get to the login form (as expected).
After entering my userdata (of a persisted user with “DefaultProvider” and “Acme.Project:User”) I expect the user to be logged in and get redirected to the action configured in “onAuthenticationSuccess” (either the original “standard/secured” or at least “$this->redirect(‘index’, ‘standard’)”…).

Instead I get redirected to dev.project.localhost/acme.project/authentication/authenticate again where the following error messages are shown above the login form:
“Authentication failed!
authenticateAction
Wrong credentials.”

This is my Security_Development.log (had to substitute @ by “(at)” because I cannot mention more than two users as a new forum user :smiley: :smiley: ):

15-08-26 21:43:43 306 127.0.0.1 INFO Flow Redirecting to authentication entry point
routeValues => array (
(at)package => Acme.Project
(at)controller => Authentication
(at)action => login
)

15-08-26 21:45:47 666 127.0.0.1 INFO Flow Session pdELSUJ494IiEGh94Jk4m7QSBFROLj8p contains auth token TYPO3\Flow\Security\Authentication\Token\UsernamePassword for provider DefaultProvider. Status: no credentials given

==========

  • Settings.yaml:
    The “roles” entry doesn’t seem to effect anything at the moment (behaviour is the same when commenting it)

  • When I shorten the “token” value in Settings.yaml
    token: 'TYPO3\Flow\Security\Authentication\Token\UsernamePassword’
    to
    token: 'UsernamePassword’
    I get the following error message:
    “Fatal error: Call to a member function
    setAuthenticationEntryPoint() on null in
    /path/to/my/project/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Flow_Security_Authentication_AuthenticationProviderManager.php
    on line 343”
    (which should be a $tokenInstance instead)

==========

Can anybody help me or provide me with examples that I can use to solve my problem?

Many thanks in advance!

Hey,

first of all I updated your trust level so you should be able to post links now :smile:

Good code example is always the neos code because there we use the policy and authentication stuff.

Some ideas:

  • Did you check the user was actually persisted to the DB? (was the create request POST)
  • requestPatterns in the provider config should include the login controller otherwise the provider will not be active during login and so the token won’t be authenticated

I guess one of te two is the problem.
Otherwise you might have new errors to share that will help resolve the problem :slight_smile:

Hey Christian,

no new errors, it works smoothly now! :smiley:

Thank you very very much!!!

I changed the “controllerObjectName” line of the “requestPatterns” option to the following and it finally worked:
TYPO3:
Flow:
security:
authentication:
providers:
DefaultProvider:
provider: 'PersistedUsernamePasswordProvider’
token: 'TYPO3\Flow\Security\Authentication\Token\UsernamePassword’
requestPatterns:
controllerObjectName: ‘Acme\Project\Controller\.*’

It also works when deleting the lines “token” and “requestPatterns”/“controllerObjectName” completely.

Next time I will also consult the NEOS code first. :thumbsup: