8000 [Security] Add a JSON authentication listener by dunglas · Pull Request #18952 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] Add a JSON authentication listener #18952

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update exception messages
  • Loading branch information
dunglas committed Dec 2, 2016
commit 10ecbe10dff57623f2c6bb1d45621220557ba143
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,25 @@ public function handle(GetResponseEvent $event)
try {
$username = $this->propertyAccessor->getValue($data, $this->options['username_path']);
} catch (AccessException $e) {
throw new BadCredentialsException(sprintf('Missing key "%s".', $this->options['username_path']));
throw new BadCredentialsException(sprintf('The key "%s" must be provided.', $this->options['username_path']));
}

try {
$password = $this->propertyAccessor->getValue($data, $this->options['password_path']);
} catch (AccessException $e) {
throw new BadCredentialsException(sprintf('Missing key "%s".', $this->options['password_path']));
throw new BadCredentialsException(sprintf('The key "%s" must be provided.', $this->options['password_path']));
}

if (!is_string($username)) {
throw new BadCredentialsException(sprintf('The key "%s" must contain a string.', $this->options['username_path']));
throw new BadCredentialsException(sprintf('The key "%s" must be a string.', $this->options['username_path']));
}

if (strlen($username) > Security::MAX_USERNAME_LENGTH) {
throw new BadCredentialsException('Invalid username.');
}

if (!is_string($password)) {
throw new BadCredentialsException(sprintf('The key "%s" must contain a string.', $this->options['password_path']));
throw new BadCredentialsException(sprintf('The key "%s" must be a string.', $this->options['password_path']));
}

try {
Expand Down
0