Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetty 12.0.x core security #9405

Merged
merged 154 commits into from May 2, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
9ec946e
initial work on core security module
lachlan-roberts Feb 3, 2023
cde90ab
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
lachlan-roberts Feb 19, 2023
94eca14
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw Feb 21, 2023
ab4b3b8
WIP
gregw Feb 22, 2023
dde8780
BASIC auth working
gregw Feb 22, 2023
7ff7d89
FORM auth working
gregw Feb 22, 2023
2db4777
FORM auth working
gregw Feb 22, 2023
5e929d5
FORM auth POST working
gregw Feb 23, 2023
e1de94e
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw Feb 23, 2023
63f394c
WIP
gregw Feb 23, 2023
a926bc1
WIP
gregw Feb 23, 2023
87fff1a
WIP
gregw Feb 23, 2023
724141c
WIP
gregw Feb 24, 2023
b34ea8f
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
gregw Feb 24, 2023
214a28c
WIP
gregw Feb 24, 2023
e33d076
WIP
gregw Feb 24, 2023
70db469
WIP auth parameters
gregw Feb 25, 2023
13cb316
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw Feb 26, 2023
00c81c4
WIP
gregw Feb 28, 2023
3b31f48
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw Mar 3, 2023
6216634
WIP
gregw Mar 3, 2023
8044355
WIP
gregw Mar 3, 2023
22fe002
WIP
gregw Mar 4, 2023
804ece1
WIP
gregw Mar 5, 2023
dfb6f2c
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw Mar 12, 2023
bc0547d
WIP
gregw Mar 12, 2023
a521f7c
WIP on JAAS tests
gregw Mar 13, 2023
2e4bcd5
WIP on major simplification
gregw Mar 13, 2023
adb84c4
WIP on major simplification
gregw Mar 13, 2023
7a3a2e0
Create OpenID module in jetty-core
lachlan-roberts Mar 30, 2023
447e54b
implement OpenID module for jetty-core
lachlan-roberts Apr 4, 2023
5328138
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw Apr 4, 2023
f60a0fb
remove isMandatory and use getConstraintAuthentication method for Aut…
lachlan-roberts Apr 5, 2023
c793052
WIP
gregw Apr 5, 2023
cf9ab28
WIP to using core for EE9
gregw Apr 6, 2023
ce2eee4
WIP to using core for EE9
gregw Apr 7, 2023
468d94a
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
gregw Apr 7, 2023
3015c49
WIP to using core for EE9
gregw Apr 7, 2023
e654b3a
WIP to using core for EE9
gregw Apr 7, 2023
071e29b
WIP to using core for EE9
gregw Apr 7, 2023
15455d1
Added core library to modules
gregw Apr 8, 2023
eeae504
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
gregw Apr 8, 2023
daa0263
Added core library to modules
gregw Apr 8, 2023
0ef2f50
fixed mod files
gregw Apr 9, 2023
e306c57
fixed ee8 files
gregw Apr 9, 2023
e1034e6
fixed ee8 jaas
gregw Apr 9, 2023
c485ccb
static
gregw Apr 10, 2023
29b44f7
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
gregw Apr 10, 2023
7c98514
fixed jaas modules
gregw Apr 10, 2023
43c0870
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw Apr 10, 2023
c4cc152
Still fixing ee8 modules
gregw Apr 10, 2023
1407d53
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
gregw Apr 10, 2023
eb29894
WIP
gregw Apr 11, 2023
a83d4e5
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
gregw Apr 11, 2023
48701d9
fix merge of jetty-12.0.x openid changes
lachlan-roberts Apr 11, 2023
061197d
Update openid to access session
gregw Apr 11, 2023
6023078
WIP
gregw Apr 12, 2023
4aee191
Renamed "Core" environment to "Server"
gregw Apr 12, 2023
67c542d
Merge branch 'jetty-12-server-environment' into jetty-12.0.x-core-sec…
gregw Apr 12, 2023
fff8ef1
fixed jaas
gregw Apr 12, 2023
5cec2c3
more jaas cleanup
gregw Apr 12, 2023
90a547d
Server env exists only in startArgs.
gregw Apr 12, 2023
a4adc62
rename Server env to JVM
gregw Apr 12, 2023
4f48ebf
Merge branch 'jetty-12-server-environment' into jetty-12.0.x-core-sec…
gregw Apr 12, 2023
8f2fcb2
rename of the rename of the rename
gregw Apr 12, 2023
8b3ec42
updates from review
gregw Apr 13, 2023
3da8d52
Merge branch 'jetty-12-server-environment' into jetty-12.0.x-core-sec…
gregw Apr 13, 2023
652eac8
Add new security jar to osgi container deployment
janbartel Apr 13, 2023
763a402
updates from review
gregw Apr 13, 2023
8283cc6
updates from review
gregw Apr 13, 2023
232fb5f
updates from review
gregw Apr 14, 2023
fb093e8
updates from review
gregw Apr 14, 2023
1c436d1
Merge branch 'jetty-12-server-environment' into jetty-12.0.x-core-sec…
gregw Apr 14, 2023
2d2dca7
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
gregw Apr 14, 2023
0eab748
ee10 compiled with core security
gregw Apr 14, 2023
1375d72
ee10 compiled with core security
gregw Apr 14, 2023
c12200b
ee10 compiled with core security
gregw Apr 14, 2023
8abcc63
ee10 security tests
gregw Apr 14, 2023
f6ede20
WIP
gregw Apr 17, 2023
01d1637
ee10 security tests
gregw Apr 17, 2023
8ae81a7
ee10 jaspi
gregw Apr 17, 2023
4ce9bef
ee10 jaspi
gregw Apr 17, 2023
60a1975
ee10 jaspi
gregw Apr 17, 2023
50dec68
fix javadoc
gregw Apr 17, 2023
e609a46
WIP
gregw Apr 18, 2023
f669a92
WIP
gregw Apr 18, 2023
0e11e85
WIP on ConstraintTest
gregw Apr 18, 2023
1f25385
WIP on ConstraintTest
gregw Apr 18, 2023
64a52ac
WIP on ConstraintTest
gregw Apr 18, 2023
f73892f
redirection tests
gregw Apr 18, 2023
20f5f64
more FormAuth fixes
gregw Apr 18, 2023
2c9bee2
All ConstraintTests passing ee10
gregw Apr 19, 2023
63b273e
All ConstraintTests passing ee10
gregw Apr 19, 2023
06e5a33
Fixed 302 to 303
gregw Apr 19, 2023
c168947
Refactor to remove forbidden as a separate boolean
gregw Apr 19, 2023
09a645b
Bizarre servlet constraint combinations
gregw Apr 19, 2023
5b6a636
Fixed checkstyle
gregw Apr 19, 2023
02f46b5
Reverted 303 change
gregw Apr 19, 2023
55d564b
Reverted 303 change
gregw Apr 19, 2023
99e5e8c
fixed jaas included
gregw Apr 19, 2023
ec9c7ca
get wrapped request from ServletContextResponse
gregw Apr 19, 2023
5a59314
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw Apr 19, 2023
9e9c448
get wrapped request from ServletContextResponse
gregw Apr 19, 2023
f92c851
Add tests for combining of Constraints as per spec
janbartel Apr 19, 2023
6738caf
cherry picked new test from 10
gregw Apr 19, 2023
b424951
turned off debug
gregw Apr 19, 2023
a41594b
fixed auth builder
gregw Apr 20, 2023
34df626
Some renaming after review
gregw Apr 20, 2023
2b4a680
Some renaming after review
gregw Apr 20, 2023
387ed6e
Some renaming after review
gregw Apr 20, 2023
46cf16b
Some renaming after review
gregw Apr 20, 2023
91a9d4c
Really bad SPNEGOAuthenticator tests
gregw Apr 21, 2023
1b926f7
Merged branch 'jetty-12.0.x' into 'jetty-12.0.x-core-security'.
sbordet Apr 23, 2023
59ca19e
Restored HttpClientAuthenticationTest.
sbordet Apr 23, 2023
f32a1d4
Restored SPNEGOAuthenticationTest.
sbordet Apr 23, 2023
d173d72
Fixed checkstyle.
sbordet Apr 23, 2023
5e41571
Fixed RequestListeners (doh!).
sbordet Apr 23, 2023
b1f0af4
remove stack trace
gregw Apr 23, 2023
f36270e
renames for clarity
gregw Apr 23, 2023
0e4eb79
Removed obsolete comment.
sbordet Apr 23, 2023
a8351ed
SPNEGO cleanup
gregw Apr 24, 2023
089d2a6
Updated comment about using the binary `|` operator.
sbordet Apr 24, 2023
8070f4f
More javadoc
gregw Apr 24, 2023
360ba88
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-…
gregw Apr 24, 2023
4a25e88
Cleaned up delegate authentication for openid and SPNEGO
gregw Apr 24, 2023
eb3f72c
Updates from review
gregw Apr 25, 2023
3e11cb8
Updates from review
gregw Apr 25, 2023
2206c00
Updates from review
gregw Apr 25, 2023
010a1dd
Updates from review
gregw Apr 25, 2023
33f6e0b
Fixes from updates from review
gregw Apr 25, 2023
2616604
Fixes from updates from review
gregw Apr 25, 2023
fdc7410
Fixes from updates from review
gregw Apr 25, 2023
835ffc7
Fixes from updates from review
gregw Apr 26, 2023
3f9d35b
Fixes from updates from review
gregw Apr 26, 2023
b00a484
Use INHERIT instead of null for "don't care"
gregw Apr 26, 2023
fa72876
Fixes from updates from review
gregw Apr 26, 2023
deffe0b
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw Apr 26, 2023
1bd1808
resovled some TODOs
gregw Apr 27, 2023
a250a39
resolved some TODOs
gregw Apr 27, 2023
81ef12f
Moved some classes to better locations
gregw Apr 27, 2023
7f8ca79
Renamed Authenticator.Configuration
gregw Apr 27, 2023
e95a478
updates from a review
gregw Apr 27, 2023
5b5f3d6
updates from a review
gregw Apr 28, 2023
d5b18bf
Update jetty-core/jetty-security/src/main/java/org/eclipse/jetty/secu…
gregw Apr 29, 2023
8a35ff5
comment usage of MD5
gregw Apr 29, 2023
03c8537
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw Apr 29, 2023
05f7507
removed redundant request field
gregw Apr 29, 2023
37e0d5d
removed redundant response field
gregw Apr 29, 2023
4080c22
updates from a review
gregw Apr 29, 2023
0fb1545
updates from a review
gregw Apr 30, 2023
e5e7322
updates from review
gregw Apr 30, 2023
bc64fc8
Merge branch 'jetty-12.0.x' into jetty-12.0.x-core-security
gregw May 1, 2023
56e5731
updates from review
gregw May 1, 2023
5cbf23b
finish renaming
gregw May 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -273,7 +273,7 @@ private Request param(String name, String value, boolean fromQuery)
@Override
public Fields getParams()
{
return new Fields(params, true);
return params.asImmutable();
}

@Override
Expand Down
4 changes: 4 additions & 0 deletions jetty-core/jetty-ee/pom.xml
Expand Up @@ -33,6 +33,10 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-io</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-security</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions jetty-core/jetty-ee/src/main/java/module-info.java
Expand Up @@ -16,9 +16,11 @@
requires org.slf4j;

requires transitive org.eclipse.jetty.io;
requires transitive org.eclipse.jetty.security;

// Only required if using JMX.
requires static org.eclipse.jetty.jmx;

exports org.eclipse.jetty.ee;
exports org.eclipse.jetty.ee.security;
}
@@ -0,0 +1,68 @@
//
// ========================================================================
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//

package org.eclipse.jetty.ee.security;

import java.util.List;
import java.util.Set;

public interface ConstraintAware
{
List<ConstraintMapping> getConstraintMappings();

Set<String> getKnownRoles();

/**
* Set Constraint Mappings and roles.
* Can only be called during initialization.
*
* @param constraintMappings the mappings
* @param roles the roles
*/
void setConstraintMappings(List<ConstraintMapping> constraintMappings, Set<String> roles);
gregw marked this conversation as resolved.
Show resolved Hide resolved

/**
* Add a Constraint Mapping.
* May be called for running webapplication as an annotated servlet is instantiated.
*
* @param mapping the mapping
*/
void addConstraintMapping(ConstraintMapping mapping);

/**
* Add a Role definition.
* May be called on running webapplication as an annotated servlet is instantiated.
*
* @param role the role
*/
void addKnownRole(String role);

/**
* See Servlet Spec 31, sec 13.8.4, pg 145
gregw marked this conversation as resolved.
Show resolved Hide resolved
* When true, requests with http methods not explicitly covered either by inclusion or omissions
* in constraints, will have access denied.
*
* @param deny true for denied method access
*/
void setDenyUncoveredHttpMethods(boolean deny);

boolean isDenyUncoveredHttpMethods();

/**
* See Servlet Spec 31, sec 13.8.4, pg 145
gregw marked this conversation as resolved.
Show resolved Hide resolved
* Container must check if there are urls with uncovered http methods
*
* @return true if urls with uncovered http methods
*/
boolean checkPathsWithUncoveredHttpMethods();
}
@@ -0,0 +1,85 @@
//
// ========================================================================
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//

package org.eclipse.jetty.ee.security;

import org.eclipse.jetty.security.Constraint;

public class ConstraintMapping
{
String _method;
String[] _methodOmissions;
String _pathSpec;
Constraint _constraint;

/**
* @return Returns the constraint.
*/
public Constraint getConstraint()
{
return _constraint;
}

/**
* @param constraint The constraint to set.
*/
public void setConstraint(Constraint constraint)
{
this._constraint = constraint;
}

/**
* @return Returns the method.
*/
public String getMethod()
{
return _method;
}

/**
* @param method The method to set.
*/
public void setMethod(String method)
{
this._method = method;
}

/**
* @return Returns the pathSpec.
*/
public String getPathSpec()
{
return _pathSpec;
}

/**
* @param pathSpec The pathSpec to set.
*/
public void setPathSpec(String pathSpec)
{
this._pathSpec = pathSpec;
}

/**
* @param omissions The http-method-omission
*/
public void setMethodOmissions(String[] omissions)
{
_methodOmissions = omissions;
}

public String[] getMethodOmissions()
{
return _methodOmissions;
}
}
65 changes: 65 additions & 0 deletions jetty-core/jetty-security/pom.xml
@@ -0,0 +1,65 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-core</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-security</artifactId>
<name>Core :: Security </name>
gregw marked this conversation as resolved.
Show resolved Hide resolved
<description>The common jetty security implementation</description>
gregw marked this conversation as resolved.
Show resolved Hide resolved

<properties>
<bundle-symbolic-name>${project.groupId}.security</bundle-symbolic-name>
<spotbugs.onlyAnalyze>org.eclipse.jetty.security.*</spotbugs.onlyAnalyze>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
@{argLine}
${jetty.surefire.argLine}
--add-reads org.eclipse.jetty.security=org.eclipse.jetty.logging
</argLine>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-session</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http-tools</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
27 changes: 27 additions & 0 deletions jetty-core/jetty-security/src/main/java/module-info.java
@@ -0,0 +1,27 @@
//
// ========================================================================
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//

module org.eclipse.jetty.security
{
requires transitive org.eclipse.jetty.server;
requires transitive org.eclipse.jetty.util;
requires transitive org.slf4j;
requires java.security.jgss;
requires java.sql;
gregw marked this conversation as resolved.
Show resolved Hide resolved

exports org.eclipse.jetty.security;
gregw marked this conversation as resolved.
Show resolved Hide resolved
exports org.eclipse.jetty.security.authentication;
exports org.eclipse.jetty.security.internal;

uses org.eclipse.jetty.security.Authenticator.Factory;
}