提交 e1f05317 编写于 作者: K kohsuke

bug fix in the UI&code coordination.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6229 71c3de6d-444a-0410-be80-ed276b4c234a
上级 657ff3df
......@@ -858,6 +858,14 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node
return SecurityMode.SECURED;
}
/**
* @return
* never null.
*/
public SecurityRealm getSecurityRealm() {
return securityRealm;
}
/**
* Returns the root {@link ACL}.
*
......
......@@ -41,6 +41,12 @@ public abstract class AuthorizationStrategy implements Describable<Authorization
*/
public abstract ACL getRootACL();
/**
* All registered {@link SecurityRealm} implementations.
*/
public static final DescriptorList<AuthorizationStrategy> LIST = new DescriptorList<AuthorizationStrategy>(
);
/**
* {@link AuthorizationStrategy} that implements the semantics
* of unsecured Hudson where everyone has full control.
......@@ -89,12 +95,9 @@ public abstract class AuthorizationStrategy implements Describable<Authorization
}
};
static {
// can't do this in the constructor due to the initialization order
LIST.add(Unsecured.DESCRIPTOR);
}
}
/**
* All registered {@link SecurityRealm} implementations.
*/
public static final DescriptorList<AuthorizationStrategy> LIST = new DescriptorList<AuthorizationStrategy>(
Unsecured.DESCRIPTOR
);
}
package hudson.security;
import org.acegisecurity.AuthenticationManager;
import org.acegisecurity.MockAuthenticationManager;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.DataBoundConstructor;
import hudson.model.Descriptor;
import net.sf.json.JSONObject;
/**
* {@link SecurityRealm} implementation that uses LDAP for authentication.
......@@ -9,8 +13,16 @@ import hudson.model.Descriptor;
* @author Kohsuke Kawaguchi
*/
public class LDAPSecurityRealm extends SecurityRealm {
public final String providerUrl;
@DataBoundConstructor
public LDAPSecurityRealm(String providerUrl) {
this.providerUrl = providerUrl;
}
public AuthenticationManager createAuthenticationManager() {
throw new UnsupportedOperationException();
// TODO
return new MockAuthenticationManager(true);
}
public DescriptorImpl getDescriptor() {
......@@ -24,6 +36,10 @@ public class LDAPSecurityRealm extends SecurityRealm {
super(LDAPSecurityRealm.class);
}
public LDAPSecurityRealm newInstance(StaplerRequest req, JSONObject formData) throws FormException {
return req.bindJSON(LDAPSecurityRealm.class,formData);
}
public String getDisplayName() {
return "LDAP";
}
......
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="Server" >
<f:textbox name="ldap.server" value="${instance}" />
<f:entry title="Server URL" >
<f:textbox name="ldap.providerUrl" value="${instance.providerUrl}" />
</f:entry>
</j:jelly>
\ No newline at end of file
......@@ -15,10 +15,9 @@
<d:invokeBody />
<j:forEach var="d" items="${descriptors}" varStatus="loop">
<f:radioBlock name="${varName}" help="${d.helpFile}" value="${loop.index}"
title="${d.displayName}" checked="${attrs.instance.descriptor==d}">
<j:set var="descriptor" value="${d}" />
<j:set var="instance" value="${h.ifThenElse(attrs.instance.descriptor==d,attrs.instance,null)}" />
title="${d.displayName}" checked="${instance.descriptor==d}">
<j:set var="descriptor" value="${d}" />
<j:set var="instance" value="${h.ifThenElse(instance.descriptor==d,instance,null)}" />
<st:include from="${d}" page="${d.configPage}" optional="true" />
</f:radioBlock>
</j:forEach>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册