jenkinsci / jenkinsci/active-directory-plugin

[JENKINS-46226] Wrong building of principalname and sAMAccountName

Open
#537 0 comments 0 reactions 0 assignees View on GitHub
component:active-directory-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
53
Forks
115
PR merge metrics
No merged PRs in 30d

Description

The attributes UPN and sAMAccountName are independent.

UPN=a@​b.c.d and sAMAccountName=e are valid values for an user object in AD.

The method getPrincipalName is wrong when the user used the sAMAccountName in the login form and sAMAccountName is unequal from the first token before the @ in the UPN.

And this is the case if you follow the recommendations from Microsoft.

See here https://msdn.microsoft.com/en-us/library/ms680857(v=vs.85).aspx

This is just true for a special case and will fail in all other cases_

String samAccountName = userPrincipalName.substring(0, userPrincipalName.indexOf('@'));

 

 

 

---
Originally reported by grueni, imported from: Wrong building of principalname and sAMAccountName


  • assignee: fbelzunc
  • status: Open
  • priority: Minor
  • component(s): active-directory-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-07

Raw content of original issue

The attributes UPN and sAMAccountName are independent.
UPN=a@b.c.d and sAMAccountName=e are valid values for an user object in AD.
The method getPrincipalName is wrong when the user used the sAMAccountName in the login form and sAMAccountName is unequal from the first token before the @ in the UPN.
And this is the case if you follow the recommendations from Microsoft.

See here https://msdn.microsoft.com/en-us/library/ms680857(v=vs.85).aspx

This is just true for a special case and will fail in all other cases_
String samAccountName = userPrincipalName.substring(0, userPrincipalName.indexOf('@'));

 

 

 

  • environment: OpenIndiana hipster

Contributor guide

Open the contributing guide

Research direction

Locate the getPrincipalName method in the active-directory-plugin and inspect how the login value is converted into a principal name and sAMAccountName. Reproduce the case where the sAMAccountName differs from the first token of the UPN, then verify that independent UPN and sAMAccountName values are handled correctly without breaking other login cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.