Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf71a541

Browse files
committed
Add annotations for security headers
1 parent33e7854 commitf71a541

File tree

9 files changed

+17
-0
lines changed

9 files changed

+17
-0
lines changed

‎stubbornjava-common/src/main/java/com/stubbornjava/common/undertow/handlers/CustomHandlers.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public static HttpHandler loadBalancerHttpToHttps(HttpHandler next) {
152152
};
153153
}
154154

155+
// {{start:securityHeaders}}
155156
publicstaticHttpHandlersecurityHeaders(HttpHandlernext,ReferrerPolicypolicy) {
156157
MiddlewareBuildersecurity =MiddlewareBuilder
157158
.begin(XFrameOptionsHandlers::deny)
@@ -166,4 +167,5 @@ public static HttpHandler securityHeaders(HttpHandler next, ReferrerPolicy polic
166167
}
167168
returnsecurity.complete(next);
168169
}
170+
// {{end:securityHeaders}}
169171
}

‎stubbornjava-undertow/src/main/java/com/stubbornjava/undertow/handlers/ContentSecurityPolicyHandler.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
importio.undertow.server.HttpHandler;
99
importio.undertow.server.handlers.SetHeaderHandler;
1010

11+
// {{start:handler}}
1112
publicclassContentSecurityPolicyHandler {
1213
privatestaticfinalStringCSP_HEADER ="Content-Security-Policy";
1314

@@ -193,3 +194,4 @@ private String join(String... strings) {
193194
}
194195
}
195196
}
197+
// {{end:handler}}

‎stubbornjava-undertow/src/main/java/com/stubbornjava/undertow/handlers/ReferrerPolicyHandlers.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
importio.undertow.server.HttpHandler;
44
importio.undertow.server.handlers.SetHeaderHandler;
55

6+
// {{start:handler}}
67
publicclassReferrerPolicyHandlers {
78
privatestaticfinalStringREFERRER_POLICY_STRING ="Referrer-Policy";
89

@@ -30,3 +31,4 @@ public static HttpHandler policy(HttpHandler next, ReferrerPolicy policy) {
3031
returnnewSetHeaderHandler(next,REFERRER_POLICY_STRING,policy.getValue());
3132
}
3233
}
34+
// {{end:handler}}

‎stubbornjava-undertow/src/main/java/com/stubbornjava/undertow/handlers/StrictTransportSecurityHandlers.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
importio.undertow.server.handlers.SetHeaderHandler;
55
importio.undertow.util.Headers;
66

7+
// {{start:handler}}
78
publicclassStrictTransportSecurityHandlers {
89

910
publicstaticHttpHandlerhsts(HttpHandlernext,longmaxAge) {
@@ -14,3 +15,4 @@ public static HttpHandler hstsIncludeSubdomains(HttpHandler next, long maxAge) {
1415
returnnewSetHeaderHandler(next,Headers.STRICT_TRANSPORT_SECURITY_STRING,"max-age=" +maxAge +"; includeSubDomains");
1516
}
1617
}
18+
// {{end:handler}}

‎stubbornjava-undertow/src/main/java/com/stubbornjava/undertow/handlers/XContentTypeOptionsHandler.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
importio.undertow.server.HttpHandler;
44
importio.undertow.server.handlers.SetHeaderHandler;
55

6+
// {{start:handler}}
67
publicclassXContentTypeOptionsHandler {
78
privatestaticfinalStringX_CONTENT_TYPE_OPTIONS_STRING ="X-Content-Type-Options";
89

910
publicstaticHttpHandlernosniff(HttpHandlernext) {
1011
returnnewSetHeaderHandler(next,X_CONTENT_TYPE_OPTIONS_STRING,"nosniff");
1112
}
1213
}
14+
// {{end:handler}}

‎stubbornjava-undertow/src/main/java/com/stubbornjava/undertow/handlers/XFrameOptionsHandlers.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
importio.undertow.server.handlers.SetHeaderHandler;
88
importio.undertow.util.HttpString;
99

10+
// {{start:handler}}
1011
publicclassXFrameOptionsHandlers {
1112
privatestaticfinalStringX_FRAME_OPTIONS_STRING ="X-Frame-Options";
1213
privatestaticfinalHttpStringX_FRAME_OPTIONS =newHttpString(X_FRAME_OPTIONS_STRING);
@@ -32,3 +33,4 @@ public static HttpHandler allowFromDynamicOrigin(HttpHandler next,
3233
};
3334
}
3435
}
36+
// {{end:handler}}

‎stubbornjava-undertow/src/main/java/com/stubbornjava/undertow/handlers/XXssProtectionHandlers.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
importio.undertow.server.HttpHandler;
44
importio.undertow.server.handlers.SetHeaderHandler;
55

6+
// {{start:handler}}
67
publicclassXXssProtectionHandlers {
78
privatestaticfinalStringX_XSS_PROTECTION_STRING ="X-Xss-Protection";
89

@@ -18,3 +19,4 @@ public static HttpHandler enableAndBlock(HttpHandler next) {
1819
returnnewSetHeaderHandler(next,X_XSS_PROTECTION_STRING,"1; mode=block");
1920
}
2021
}
22+
// {{end:handler}}

‎stubbornjava-webapp/src/main/java/com/stubbornjava/webapp/StubbornJavaWebApp.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ private static HttpHandler exceptionHandler(HttpHandler next) {
3333
.addExceptionHandler(Throwable.class,PageRoutes::error);
3434
}
3535

36+
// {{start:csp}}
3637
privatestaticHttpHandlercontentSecurityPolicy(HttpHandlerdelegate) {
3738
returnnewContentSecurityPolicyHandler.Builder()
3839
.defaultSrc(ContentSecurityPolicy.SELF)
@@ -44,6 +45,7 @@ private static HttpHandler contentSecurityPolicy(HttpHandler delegate) {
4445
.styleSrc(ContentSecurityPolicy.SELF.getValue(),ContentSecurityPolicy.UNSAFE_INLINE.getValue())
4546
.build(delegate);
4647
}
48+
// {{end:csp}}
4749

4850
privatestaticHttpHandlerwrapWithMiddleware(HttpHandlernext) {
4951
returnMiddlewareBuilder.begin(PageRoutes::redirector)

‎stubbornjava-webapp/src/main/java/com/stubbornjava/webapp/post/Tags.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class Tags {
3030
publicstaticfinalTagElasticsearch =addTag(newTag(922794262770139008L,"Elasticsearch"));
3131
publicstaticfinalTagAnsible =addTag(newTag(922794262770139008L,"Ansible"));
3232
publicstaticfinalTagSupervisord =addTag(newTag(922794262770139008L,"Supervisord"));
33+
publicstaticfinalTagSecurity =addTag(newTag(953801444178362856L,"Security"));
3334

3435
privatestaticTagaddTag(Tagtag) {
3536
TAGS.add(tag);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp