-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring of
ThingsSseRoute
and WebsocketRoute
:
* `ThingsSseRoute` no longer extends `AbstractRoute` to get rid of actually unused fields and complexity. * Adjusted code formatting and extracted methods of `ThingsSseRoute` to improve readability. * Renamed `WebsocketRoute` to `WebSocketRoute` to comply to the correct notation for 'WebSocket'. * Renamed `WebsocketRouteBuilder` to `WebSocketRouteBuilder` to comply to the correct notation for 'WebSocket'. * Introduced static factory methods for `ThingsSseRoute` and `WebSocketRoute`. * Introduced `WebSocketAuthorizationEnforcer` to optionally enforce authorization before establishing a WebSocket connection. Signed-off-by: Juergen Fickel <juergen.fickel@bosch-si.com>
- Loading branch information
Juergen Fickel
committed
Oct 11, 2019
1 parent
735a181
commit e9783ba
Showing
9 changed files
with
183 additions
and
126 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
38 changes: 38 additions & 0 deletions
38
...pse/ditto/services/gateway/endpoints/routes/websocket/WebSocketAuthorizationEnforcer.java
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,38 @@ | ||
/* | ||
* Copyright (c) 2019 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.ditto.services.gateway.endpoints.routes.websocket; | ||
|
||
import org.eclipse.ditto.model.base.auth.AuthorizationContext; | ||
import org.eclipse.ditto.model.base.headers.DittoHeaders; | ||
|
||
import akka.http.javadsl.model.HttpRequest; | ||
|
||
/** | ||
* Enforces authorization in order to establish a WebSocket connection. | ||
* If the authorization check is successful nothing will happen, else a | ||
* {@link org.eclipse.ditto.model.base.exceptions.DittoRuntimeException DittoRuntimeException} is thrown. | ||
*/ | ||
public interface WebSocketAuthorizationEnforcer { | ||
|
||
/** | ||
* Ensures that the establishment of a WebSocket connection is authorized for the given arguments. | ||
* | ||
* @param authorizationContext | ||
* @param request | ||
* @param dittoHeaders | ||
* @throws NullPointerException if any argument is {@code null}. | ||
* @throws org.eclipse.ditto.model.base.exceptions.DittoRuntimeException if | ||
*/ | ||
void checkAuthorization(HttpRequest request, AuthorizationContext authorizationContext, DittoHeaders dittoHeaders); | ||
|
||
} |
Oops, something went wrong.