-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Introduce digest access authentication with SHA-256 #13236
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
base: jetty-12.1.x
Are you sure you want to change the base?
Conversation
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Oleksandr Krutko <[email protected]> improve DigestAuthenticator algorithm for SHA-256 Signed-off-by: Oleksandr Krutko <[email protected]> Improve DigestAuthenticator class Signed-off-by: Oleksandr Krutko <[email protected]>
Hello, |
@@ -58,7 +58,18 @@ public class DigestAuthenticator extends LoginAuthenticator | |||
private final ConcurrentMap<String, Nonce> _nonceMap = new ConcurrentHashMap<>(); | |||
private long _maxNonceAgeMs = 60 * 1000; | |||
private int _maxNC = 1024; | |||
private String algorithm = "MD5"; |
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.
Fields of this class are prefixed with _
, so change this to _algorithm
.
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
@Override | ||
public boolean check(Object credentials) | ||
{ | ||
{ |
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.
Remove these spaces.
if (credentials instanceof char[]) | ||
credentials = new String((char[])credentials); | ||
String password = (credentials instanceof String) ? (String)credentials : credentials.toString(); | ||
|
||
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.
Remove spaces.
} | ||
catch (Exception e) | ||
return stringEquals(TypeUtil.toString(md.digest(), 16).toLowerCase(), response == null ? null : response.toLowerCase()); | ||
|
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.
Remove empty line.
{ | ||
LOG.warn("Unable to process digest", e); | ||
} | ||
|
||
return false; | ||
return false; |
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.
Fix indentation.
} | ||
|
||
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.
Remove spaces.
@arsenalzp looks good, but please follow suggestions in my review. |
I'm in business trip right now, I will review and do all remaining parts on weekend. |
@arsenalzp We might make those changes for you so we can get this into a build this week. They are all just formatting and naming. Thanks for the contribution! |
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
Applying review comments Co-authored-by: Simone Bordet <[email protected]>
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
more format and name fixes
@sbordet I applied your suggestions and fixed some others. Can you re-review if this builds OK? |
@sbordet dang! Looks like I broke this build, I'll fix somehow |
...ty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
Outdated
Show resolved
Hide resolved
checkstyle
This is the draft PR related to #13127 which introduced SHA-256 algorithm for Digest access authentication.
In case this implementation is OK I will add related extension of
Credential
class and tests, of course.