forked from vert-x3/vertx-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Paulo Lopes <[email protected]>
- Loading branch information
Showing
20 changed files
with
145 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,9 +30,11 @@ | |
* implement it, and vice-versa: browsers that don't support CSP simply ignore it, functioning as usual, defaulting to | ||
* the standard same-origin policy for web content. If the site doesn't offer the CSP header, browsers likewise use the | ||
* standard same-origin policy. | ||
* | ||
* @author <a href="mailto:[email protected]">Paulo Lopes</a> | ||
*/ | ||
@VertxGen | ||
public interface CSPHandler extends Handler<RoutingContext> { | ||
public interface CSPHandler extends SecurityPolicyHandler { | ||
|
||
/** | ||
* Creates a new instance of the handler. | ||
|
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 |
---|---|---|
|
@@ -15,10 +15,10 @@ | |
* | ||
* This Handler requires session support, thus should be added somewhere below Session and Body handlers. | ||
* | ||
* @author Paulo Lopes | ||
* @author <a href="mailto:[email protected]">Paulo Lopes</a> | ||
*/ | ||
@VertxGen | ||
public interface CSRFHandler extends Handler<RoutingContext> { | ||
public interface CSRFHandler extends SecurityPolicyHandler { | ||
|
||
String DEFAULT_COOKIE_NAME = "XSRF-TOKEN"; | ||
|
||
|
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 |
---|---|---|
|
@@ -30,9 +30,10 @@ | |
* A handler which implements server side http://www.w3.org/TR/cors/[CORS] support for Vert.x-Web. | ||
* | ||
* @author <a href="http://tfox.org">Tim Fox</a> | ||
* @author <a href="mailto:[email protected]">Paulo Lopes</a> | ||
*/ | ||
@VertxGen | ||
public interface CorsHandler extends Handler<RoutingContext> { | ||
public interface CorsHandler extends SecurityPolicyHandler { | ||
|
||
/** | ||
* Create a CORS handler using a regular expression to match origins. An origin follows rfc6454#section-7 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,11 @@ | |
* HTTP Strict Transport Security (HSTS) <a href="http://tools.ietf.org/html/rfc6797">RFC6797</a>. | ||
* | ||
* This handler adds the strict transport security headers, for this domain or subdomains. | ||
* | ||
* @author <a href="mailto:[email protected]">Paulo Lopes</a> | ||
*/ | ||
@VertxGen | ||
public interface HSTSHandler extends Handler<RoutingContext> { | ||
public interface HSTSHandler extends SecurityPolicyHandler { | ||
|
||
// 6 months | ||
long DEFAULT_MAX_AGE = 15768000; | ||
|
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 |
---|---|---|
|
@@ -29,10 +29,10 @@ | |
/** | ||
* An auth handler that provides One Time Password (Multi-Factor) Authentication support. | ||
* | ||
* @author Paulo Lopes | ||
* @author <a href="mailto:[email protected]">Paulo Lopes</a> | ||
*/ | ||
@VertxGen | ||
public interface OtpAuthHandler extends Handler<RoutingContext> { | ||
public interface OtpAuthHandler extends AuthenticationHandler { | ||
|
||
/** | ||
* Create a new instance of this handler using a time based one time password authentication provider. | ||
|
36 changes: 36 additions & 0 deletions
36
vertx-web/src/main/java/io/vertx/ext/web/handler/PlatformHandler.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,36 @@ | ||
/* | ||
* Copyright 2021 Red Hat, Inc. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* | ||
* The Eclipse Public License is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* The Apache License v2.0 is available at | ||
* http://www.opensource.org/licenses/apache2.0.php | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
*/ | ||
package io.vertx.ext.web.handler; | ||
|
||
import io.vertx.codegen.annotations.VertxGen; | ||
import io.vertx.core.Handler; | ||
import io.vertx.ext.web.RoutingContext; | ||
|
||
/** | ||
* Base platform interface for handlers that provide functionality to the application platform. | ||
* | ||
* Two examples are: | ||
* | ||
* <ul> | ||
* <li>{@link BodyHandler}</li> | ||
* <li>{@link SessionHandler}</li> | ||
* </ul> | ||
* | ||
* @author <a href="mailto:[email protected]">Paulo Lopes</a> | ||
*/ | ||
@VertxGen(concrete = false) | ||
public interface PlatformHandler extends Handler<RoutingContext> { | ||
} |
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
33 changes: 33 additions & 0 deletions
33
vertx-web/src/main/java/io/vertx/ext/web/handler/SecurityPolicyHandler.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,33 @@ | ||
/* | ||
* Copyright 2021 Red Hat, Inc. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* | ||
* The Eclipse Public License is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* The Apache License v2.0 is available at | ||
* http://www.opensource.org/licenses/apache2.0.php | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
*/ | ||
package io.vertx.ext.web.handler; | ||
|
||
import io.vertx.codegen.annotations.VertxGen; | ||
import io.vertx.core.Handler; | ||
import io.vertx.ext.web.RoutingContext; | ||
|
||
/** | ||
* Base security policy interface for handlers that provide HTTP security related headers. | ||
* <p> | ||
* Sub-interfaces help you secure your applications by setting various HTTP headers. <i>It's not a silver bullet</i>, | ||
* but it can help! | ||
* <p> | ||
* | ||
* @author <a href="mailto:[email protected]">Paulo Lopes</a> | ||
*/ | ||
@VertxGen(concrete = false) | ||
public interface SecurityPolicyHandler extends Handler<RoutingContext> { | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,6 @@ | |
package io.vertx.ext.web.handler; | ||
|
||
import io.vertx.codegen.annotations.VertxGen; | ||
import io.vertx.core.Handler; | ||
import io.vertx.ext.web.RoutingContext; | ||
|
||
/** | ||
* The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render | ||
|
@@ -27,10 +25,10 @@ | |
* The added security is provided only if the user accessing the document is using a browser that supports | ||
* {@code X-Frame-Options}. | ||
* | ||
* @author Paulo Lopes | ||
* @author <a href="mailto:[email protected]">Paulo Lopes</a> | ||
*/ | ||
@VertxGen | ||
public interface XFrameHandler extends Handler<RoutingContext> { | ||
public interface XFrameHandler extends SecurityPolicyHandler { | ||
|
||
/** | ||
* The page cannot be displayed in a frame, regardless of the site attempting to do so. | ||
|
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