gwkunze / dynamo-session-bundle

DynamoDb Session Handler for Symfony 2
MIT License
13 stars 10 forks source link

Authentication against AWS is attempted even when session.handler_id is not set to dynamo_session_handler #1

Closed choonge closed 9 years ago

choonge commented 9 years ago

I want to use DynamoDB for session handling only on staging and production, not on my local dev environment. To achieve this, I have this in my config.yml:

framework:
    session:
        handler_id: %session.handler_id%

gwk_dynamo_session:
    aws:
        key: %session.dynamo_aws_key%
        secret: %session.dynamo_aws_secret%

And in my parameters.yml.dist:

parameters:
    session.handler_id: null
    session.dynamo_aws_key: null
    session.dynamo_aws_secret: null

After a composer install on my local dev environment, I press 3x [enter] for these parameters since I don't intend to use DynamoDB. That means the above null values are copied to my actual parameters.yml.

When I then hit the frontend, I get this error:

LogicException: Invalid DynamoDB security credentials or insufficient permissions

Expected behaviour: if session.handler_id is null, it defaults to the session handler configured in php.ini. At this point, no authentication against AWS should be attempted.

Will send a pull request.

choonge commented 9 years ago

PS. If you merge this pull request it would be great if you could create a new release tag afterwards, so I can include that new tag in my composer.json rather than dev-master :) Thanks!

choonge commented 9 years ago

Awesome, thank you!

artursvonda commented 9 years ago

Not everybody uses the parameter "session.handler_id" so script shouldn't rely on it. I had error thrown because I didn't use it.

choonge commented 9 years ago

Ah, I thought session.handler_id was always set, just "null" by default. Would adding $container->hasParameter("session.handler_id") before actually getting it, solve your issue, @artursvonda ?

artursvonda commented 9 years ago

I think you could try checking the actual session handler id since most people won't have that parameter set and thus won't have this bundle working. I could try pushing PR later to solve this.