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

PAYARA-3093 Non-Standard Admin Name Causes 403 #3157

Merged
merged 1 commit into from
Sep 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public RealmAdapter(String realmName, String moduleID) {
public void initializeRealm(Object descriptor, boolean isSystemApp, String realmName) {
webDescriptor = (WebBundleDescriptor) descriptor;

computeRealmName(webDescriptor, realmName);
this.realmName = computeRealmName(webDescriptor, realmName);

jaccContextId = WebSecurityManager.getContextID(webDescriptor);

Expand All @@ -263,7 +263,7 @@ public void initializeRealm(Object descriptor, boolean isSystemApp, String realm
}

moduleID = webDescriptor.getModuleID();
jaspicRealm = new JaspicRealm(realmName, isSystemApp, webDescriptor, requestTracing);
jaspicRealm = new JaspicRealm(this.realmName, isSystemApp, webDescriptor, requestTracing);
cNonceValidator = new CNonceValidator(webDescriptor, appCNonceCacheMapProvider, cNonceCacheFactoryProvider);
}

Expand Down Expand Up @@ -952,16 +952,17 @@ private boolean authenticate(String username, char[] password, X509Certificate[]
return false;
}

private void computeRealmName(WebBundleDescriptor webDescriptor, String realmName) {
private String computeRealmName(WebBundleDescriptor webDescriptor, String realmName) {
Application application = webDescriptor.getApplication();
LoginConfiguration loginConfig = webDescriptor.getLoginConfiguration();
this.realmName = application.getRealm();
if (this.realmName == null && loginConfig != null) {
this.realmName = loginConfig.getRealmName();
String computedRealmName = application.getRealm();
if (computedRealmName == null && loginConfig != null) {
computedRealmName = loginConfig.getRealmName();
}
if (realmName != null && (this.realmName == null || this.realmName.equals(""))) {
this.realmName = realmName;
if (realmName != null && (computedRealmName == null || computedRealmName.equals(""))) {
computedRealmName = realmName;
}
return computedRealmName;
}

private void doLogout(HttpRequest request, boolean extensionEnabled) {
Expand Down