-
Notifications
You must be signed in to change notification settings - Fork 186
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
#96 Add protocols parameter on Tomcat valves #97
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6af4510
Fix Maven build
hasalex 3da8c57
#96 Add protocols parameter on Tomcat valves (Tomcat 7)
hasalex 030f94e
#96 Add protocols parameter on Tomcat valves (documentation)
hasalex 540deab
Fix typo in WaffleAuthenticatorBaseTest
hasalex 2a439c2
#96 Add protocols parameter on Tomcat valves (demo)
hasalex 29245e6
#96 Add protocols parameter on Tomcat valves (changelog)
hasalex fe34bc0
#96 Add protocols parameter on Tomcat valves (Tomcat 5, 6, 8)
hasalex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion
2
Source/JNA/waffle-demo-parent/waffle-mixed/META-INF/context.xml
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<Context> | ||
<Valve className="waffle.apache.MixedAuthenticator" principalFormat="fqn" roleFormat="both" allowGuestLogin="false" /> | ||
<Valve className="waffle.apache.MixedAuthenticator" principalFormat="fqn" roleFormat="both" allowGuestLogin="false" protocols="Negotiate,NTLM" /> | ||
<Realm className="waffle.apache.WindowsRealm" /> | ||
</Context> |
2 changes: 1 addition & 1 deletion
2
Source/JNA/waffle-demo-parent/waffle-negotiate/META-INF/context.xml
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<Context> | ||
<Valve className="waffle.apache.NegotiateAuthenticator" principalFormat="fqn" roleFormat="both" /> | ||
<Valve className="waffle.apache.NegotiateAuthenticator" principalFormat="fqn" roleFormat="both" protocols="Negotiate,NTLM" /> | ||
<Realm className="waffle.apache.WindowsRealm" /> | ||
</Context> |
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
62 changes: 62 additions & 0 deletions
62
Source/JNA/waffle-tomcat5/src/test/java/waffle/apache/WaffleAuthenticatorBaseTest.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,62 @@ | ||
package waffle.apache; | ||
|
||
import org.apache.catalina.connector.Request; | ||
import org.apache.catalina.connector.Response; | ||
import org.apache.catalina.deploy.LoginConfig; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
public class WaffleAuthenticatorBaseTest { | ||
|
||
WaffleAuthenticatorBase waffleAuthenticatorBase; | ||
|
||
@Before | ||
public void init() { | ||
waffleAuthenticatorBase = new WaffleAuthenticatorBase() { | ||
{ | ||
_log = LoggerFactory.getLogger(WaffleAuthenticatorBaseTest.class); | ||
} | ||
@Override | ||
protected boolean authenticate(Request request, Response response, LoginConfig loginConfig) throws IOException { | ||
return false; | ||
} | ||
}; | ||
} | ||
|
||
@Test | ||
public void should_accept_NTLM_protocol() throws Exception { | ||
waffleAuthenticatorBase.setProtocols(" NTLM "); | ||
|
||
assertEquals("One protocol added", 1, waffleAuthenticatorBase._protocols.size()); | ||
assertEquals("NTLM", waffleAuthenticatorBase._protocols.iterator().next()); | ||
} | ||
|
||
@Test | ||
public void should_accept_Negotiate_protocol() throws Exception { | ||
waffleAuthenticatorBase.setProtocols(" Negotiate "); | ||
|
||
assertEquals("One protocol added", 1, waffleAuthenticatorBase._protocols.size()); | ||
assertEquals("Negotiate", waffleAuthenticatorBase._protocols.iterator().next()); | ||
} | ||
|
||
@Test | ||
public void should_accept_both_protocols() throws Exception { | ||
waffleAuthenticatorBase.setProtocols(" NTLM , , Negotiate "); | ||
|
||
assertEquals("Two protocols added", 2, waffleAuthenticatorBase._protocols.size()); | ||
assertTrue("NTLM has been added", waffleAuthenticatorBase._protocols.contains("NTLM")); | ||
assertTrue("Negotiate has been added", waffleAuthenticatorBase._protocols.contains("Negotiate")); | ||
} | ||
|
||
@Test(expected = RuntimeException.class) | ||
public void should_refuse_other_protocol() throws Exception { | ||
waffleAuthenticatorBase.setProtocols(" NTLM , OTHER, Negotiate "); | ||
|
||
} | ||
} |
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
63 changes: 63 additions & 0 deletions
63
Source/JNA/waffle-tomcat6/src/test/java/waffle/apache/WaffleAuthenticatorBaseTest.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,63 @@ | ||
package waffle.apache; | ||
|
||
import org.apache.catalina.connector.Request; | ||
import org.apache.catalina.connector.Response; | ||
import org.apache.catalina.deploy.LoginConfig; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
public class WaffleAuthenticatorBaseTest { | ||
|
||
WaffleAuthenticatorBase waffleAuthenticatorBase; | ||
|
||
@Before | ||
public void init() { | ||
waffleAuthenticatorBase = new WaffleAuthenticatorBase() { | ||
{ | ||
_log = LoggerFactory.getLogger(WaffleAuthenticatorBaseTest.class); | ||
} | ||
@Override | ||
protected boolean authenticate(Request request, Response response, LoginConfig loginConfig) throws IOException { | ||
return false; | ||
} | ||
}; | ||
} | ||
|
||
@Test | ||
public void should_accept_NTLM_protocol() throws Exception { | ||
waffleAuthenticatorBase.setProtocols(" NTLM "); | ||
|
||
assertEquals("One protocol added", 1, waffleAuthenticatorBase._protocols.size()); | ||
assertEquals("NTLM", waffleAuthenticatorBase._protocols.iterator().next()); | ||
} | ||
|
||
@Test | ||
public void should_accept_Negotiate_protocol() throws Exception { | ||
waffleAuthenticatorBase.setProtocols(" Negotiate "); | ||
|
||
assertEquals("One protocol added", 1, waffleAuthenticatorBase._protocols.size()); | ||
assertEquals("Negotiate", waffleAuthenticatorBase._protocols.iterator().next()); | ||
} | ||
|
||
@Test | ||
public void should_accept_both_protocols() throws Exception { | ||
waffleAuthenticatorBase.setProtocols(" NTLM , , Negotiate "); | ||
|
||
assertEquals("Two protocols added", 2, waffleAuthenticatorBase._protocols.size()); | ||
assertTrue("NTLM has been added", waffleAuthenticatorBase._protocols.contains("NTLM")); | ||
assertTrue("Negotiate has been added", waffleAuthenticatorBase._protocols.contains("Negotiate")); | ||
} | ||
|
||
@Test(expected = RuntimeException.class) | ||
public void should_refuse_other_protocol() throws Exception { | ||
waffleAuthenticatorBase.setProtocols(" NTLM , OTHER, Negotiate "); | ||
|
||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because relative path of waffle-demo-parent is just the parent directory. And build fails with the ./waffle-demo-parent relativePath.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! This is a pretty good indication that some refactoring is still needed to bring this into a better maven structure. I'll look at addressing that soon. The layout now is a little misleading especially around the demo. Waffle-pom suffers the same design flaw but was setup properly.