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

Make Realm removal optional #1

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions RemoteUserJiraAuth/RemoteUserJiraAuth.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ header=x-forward-name
#trustedhosts=192.168.0.1,127.0.0.1
#trustedhosts=
trustedhosts=10.1.1.100,127.0.0.1

## Split username on REALM and use only part without it, example:
## [email protected] will become by default joe.black
## Default is set to set to true, Comment out and set to false if you need full name
#removeRealm=false
2 changes: 1 addition & 1 deletion RemoteUserJiraAuth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>anguswarren.jira</groupId>
<artifactId>RemoteUserJiraAuth</artifactId>
<version>1.2</version>
<version>1.3</version>

<organization>
<name>Angus Warren</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,17 @@ public Principal getUser(HttpServletRequest request, HttpServletResponse respons
}

if (remoteuser != null) {
String[] username = remoteuser.split("@");
user = getUser(username[0]);
Boolean removeRealm = new Boolean(true);
if (p.getProperty("removeRealm") != null) {
removeRealm = Boolean.parseBoolean(p.getProperty("removeRealm"));
}
if (removeRealm) {
log.debug("Trying to resolve remoteuser: " + remoteuser.split("@")[0]);
user = getUser(remoteuser.split("@")[0]);
} else {
log.debug("Trying to resolve remoteuser: " + remoteuser);
user = getUser(remoteuser);
}
log.debug("Logging in with username: " + user);
request.getSession().setAttribute(JiraSeraphAuthenticator.LOGGED_IN_KEY, user);
request.getSession().setAttribute(JiraSeraphAuthenticator.LOGGED_OUT_KEY, null);
Expand Down