-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/mbapi #134
base: develop
Are you sure you want to change the base?
Feature/mbapi #134
Conversation
@@ -15,6 +15,20 @@ security: | |||
login: | |||
pattern: ^/user/login$ | |||
security: false | |||
|
|||
jwt_login: | |||
pattern: ^/api/login_check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should the response look like? Simple JSON containing an error code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, HTTP Code 401 should remain and IMO as body something like {"error": "User <username> not found"}
is sufficient.
…from .env file and autogenerate it in bootstrap/remove database reference in doctrine.yaml
The key pair is generated using
bin/console lexik:jwt:generate-keypair
, with keys stored inapplication/config/jwt
. This directory is excluded from version control via.gitignore
and is integrated into thebootstrap
command.When merging, ensure the dependent branch on
mapbender/mapbender
is merged first, then updatecomposer.json
andcomposer.lock
to reflect any dependency changes.The JWT token can be obtained by sending authentication data (in JSON format:
{ "username": "<username>", "password": "<password>" }
) to<server_url>/api/login_check
.Example Curl command:
Extend your virtual host configuration according to https://github.com/lexik/LexikJWTAuthenticationBundle/blob/3.x/Resources/doc/index.rst#important-note-for-apache-users
The class responsible for handling API requests is located in
mapbender/mapbender
atapplication/mapbender/src/Mapbender/CoreBundle/Controller/ApiController.php
. Access to endpoints such as<server_url>/api/example
or<server_url>/api/my_custom_command
is granted through this authentication token.Example curl command: