Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinston Prakash2012-01-10 01:03:53 -0500
committerWinston Prakash2012-01-10 01:03:53 -0500
commit82acf4773947a90450ae04bef07c3f11688d7908 (patch)
treede41a26570b41f295da571f88df1d936f2ae3f89
parenta7f13c65c1371558cce75b36a5b776dca3a00156 (diff)
downloadorg.eclipse.hudson.core-82acf4773947a90450ae04bef07c3f11688d7908.tar.gz
org.eclipse.hudson.core-82acf4773947a90450ae04bef07c3f11688d7908.tar.xz
org.eclipse.hudson.core-82acf4773947a90450ae04bef07c3f11688d7908.zip
Add new field security mode for the SecurityRealms
-rw-r--r--hudson-core/src/main/java/hudson/model/Hudson.java29
-rw-r--r--hudson-core/src/main/java/hudson/security/SecurityRealm.java14
2 files changed, 27 insertions, 16 deletions
diff --git a/hudson-core/src/main/java/hudson/model/Hudson.java b/hudson-core/src/main/java/hudson/model/Hudson.java
index 3ca32324..d17c9510 100644
--- a/hudson-core/src/main/java/hudson/model/Hudson.java
+++ b/hudson-core/src/main/java/hudson/model/Hudson.java
@@ -73,9 +73,7 @@ import hudson.security.AccessControlled;
import hudson.security.AuthorizationStrategy;
import hudson.security.BasicAuthenticationFilter;
import hudson.security.FederatedLoginService;
-import hudson.security.FullControlOnceLoggedInAuthorizationStrategy;
import hudson.security.HudsonFilter;
-import hudson.security.LegacySecurityRealm;
import hudson.security.Permission;
import hudson.security.PermissionGroup;
import hudson.security.SecurityMode;
@@ -1951,14 +1949,8 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
public SecurityMode getSecurity() {
// fix the variable so that this code works under concurrent modification to securityRealm.
SecurityRealm realm = securityRealm;
-
- if (realm == SecurityRealm.NO_AUTHENTICATION) {
- return SecurityMode.UNSECURED;
- }
- if (realm instanceof LegacySecurityRealm) {
- return SecurityMode.LEGACY;
- }
- return SecurityMode.SECURED;
+
+ return realm.getSecurityMode();
}
/**
@@ -2393,16 +2385,21 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
if (authorizationStrategy == null) {
if (useSecurity == null || !useSecurity) {
authorizationStrategy = AuthorizationStrategy.UNSECURED;
- } else {
- authorizationStrategy = new FullControlOnceLoggedInAuthorizationStrategy();
- }
+ }
+// else {
+// authorizationStrategy = new FullControlOnceLoggedInAuthorizationStrategy();
+// }
}
+
+
+
if (securityRealm == null) {
if (useSecurity == null || !useSecurity) {
setSecurityRealm(SecurityRealm.NO_AUTHENTICATION);
- } else {
- setSecurityRealm(new LegacySecurityRealm());
- }
+ }
+// else {
+// setSecurityRealm(new LegacySecurityRealm());
+// }
} else {
// force the set to proxy
setSecurityRealm(securityRealm);
diff --git a/hudson-core/src/main/java/hudson/security/SecurityRealm.java b/hudson-core/src/main/java/hudson/security/SecurityRealm.java
index a564d761..6eddfa47 100644
--- a/hudson-core/src/main/java/hudson/security/SecurityRealm.java
+++ b/hudson-core/src/main/java/hudson/security/SecurityRealm.java
@@ -194,6 +194,15 @@ public abstract class SecurityRealm extends AbstractDescribableImpl<SecurityReal
public String getLoginUrl() {
return "login";
}
+
+ /**
+ * Return security mode of this realm
+ * @return
+ * @since 3.0.0
+ */
+ public SecurityMode getSecurityMode(){
+ return SecurityMode.SECURED;
+ }
/**
* Returns true if this {@link SecurityRealm} supports explicit logout operation.
@@ -426,6 +435,11 @@ public abstract class SecurityRealm extends AbstractDescribableImpl<SecurityReal
public static final SecurityRealm NO_AUTHENTICATION = new None();
private static class None extends SecurityRealm {
+
+ @Override
+ public SecurityMode getSecurityMode(){
+ return SecurityMode.UNSECURED;
+ }
public SecurityComponents createSecurityComponents() {
return new SecurityComponents(new AuthenticationManager() {

Back to the top