-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle AuthorizationFailedRejection (#1339)
Update the default handler so it will use a 401 code rather than 400. Also adds a custom rejection type that can be used for custom directives to provide more context into why the authorization failed.
- Loading branch information
1 parent
bf98d56
commit f7db74b
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
atlas-akka/src/main/scala/com/netflix/atlas/akka/CustomRejection.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2014-2021 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.netflix.atlas.akka | ||
|
||
import akka.http.scaladsl.model.StatusCode | ||
import akka.http.scaladsl.server.Rejection | ||
|
||
/** | ||
* Rejection type that can be used with the RequestHandler to fully customize the status | ||
* code and diagnostic message returned to the user. | ||
*/ | ||
case class CustomRejection(status: StatusCode, message: String) extends Rejection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters