提交 db1b7eef 编写于 作者: R Rob Petti 提交者: Kohsuke Kawaguchi

[FIXED JENKINS-13526] use '@' prefix to force PAM to interpret the user/group as a group

上级 22583135
......@@ -63,6 +63,9 @@ Upcoming changes</a>
<li class=bug>
End up more gracefully if there's some problem when searching for user partipication in the build
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-13564">issue 13564</a>)
<li class=rfe>
PAM authentication supports '@group' to force interpretation as a group instead of user.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-13526">issue 13526</a>)
<li class=rfe>
Added a DISCOVER permission to allow anonymous users to be presented the login screen
when accessing job URLs.
......
......@@ -104,12 +104,18 @@ public class PAMSecurityRealm extends AbstractPasswordBasedSecurityRealm {
@Override
public GroupDetails loadGroupByGroupname(final String groupname) throws UsernameNotFoundException, DataAccessException {
if(CLibrary.libc.getgrnam(groupname)==null)
throw new UsernameNotFoundException(groupname);
final String group;
if(groupname.startsWith("@")) {
group = groupname.substring(1);
} else {
group = groupname;
}
if(CLibrary.libc.getgrnam(group)==null)
throw new UsernameNotFoundException(group);
return new GroupDetails() {
@Override
public String getName() {
return groupname;
return group;
}
};
}
......
......@@ -5,7 +5,13 @@
<p>
This mode will also allow you to use Unix groups for authorization. For example,
you can say "everyone in the 'developers' group will have the administrator access".
you can say "everyone in the 'developers' group will have the administrator access".
<p>
Unix allows an user and a group to have the same name. If you need to disambiguate,
you can use the '@' prefix to force the name to be interpreted as a group. For example,
'@dev' would mean the 'dev' group and not the 'dev' user, while 'dev' would be interpreted
as an user if you indeed have the user of that name.
<p>
This is done through a library called <a href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules">PAM</a>,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册