-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update AuthorizationFactory interface (#1704)
Update `AuthorizationFactory` interface to make it more secure. ## The issues ### Wrong method invoked during on-the-fly authorization ```java TeletraanAuthorizer<TeletraanPrincipal> authorizer = authorizationFactory.create(context); ``` When `CompositeAuthorizationFactory` is configured, this always returns the `BasePastisAuthorizer`. It is a problem because `ScriptTokenPrincipal` can only be authorized by `ScriptTokenRoleAuthorizer`, otherwise illegal access is possible. It was prevented before the introduction of on-the-fly authorization via bundling the authenticator and the authorizer in the auth filter creation. ### `AuthorizationFactory` interface The interface of `AuthorizationFactory` makes it possible get wrong authorizer. ```java <P extends TeletraanPrincipal> TeletraanAuthorizer<P> create(TeletraanServiceContext context) throws Exception; ``` ## Fixes ### Dissociate `TeletraanAuthorizer` and `Authorizer` interfaces. `TeletraanAuthorizer` stops extending `Authorizer`. All authorizers implementing `TeletraanAuthorizer` now need to implement `TeletraanAuthorizer` and `Authorizer` respectively. ### New method in `AuthorizationFactory` The existing methods are updated to return `Authorizer`. ```java <P extends TeletraanPrincipal> Authorizer<P> create(TeletraanServiceContext context); ``` Introduced a new method to return `TeletraanAuthorizer`. ### Call new method in `EnvCapacities` ```java authorizationFactory.createSecondaryAuthorizer( context, teletraanPrincipal.getClass()); ``` And it's the only option now, no way to be mistaken.
- Loading branch information
1 parent
5b0fe03
commit 862458a
Showing
17 changed files
with
228 additions
and
92 deletions.
There are no files selected for viewing
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
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
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
Oops, something went wrong.