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

Concatenating firstname and lastname #117

Closed
DanielMalmgren opened this issue Jul 1, 2022 · 2 comments
Closed

Concatenating firstname and lastname #117

DanielMalmgren opened this issue Jul 1, 2022 · 2 comments

Comments

@DanielMalmgren
Copy link
Contributor

Hi.
I have one more small thing here that would make my solution perfect, wondering if you're willing to help?

Thing is, now it works like a charm for "normal" users here. My problem is that we will be having some external users that doesn't exist in our user directory, and they will log in e-identification. Among the info I can get for them I have no attribute for full name, but I have two attributes for firstname and lastname. Stupidly enough my idp doesn't have support for simply putting those values together into one attribute, so I have no way of sending their full name in the openid id token.

So what I'm wondering is if this would be possible: If there is no "name" in the openid info, instead check if there are a "firstname" and a "lastname" (or whatever, I can call them what I want in my end) and if there is, concatenate them with a space in between and use the result as name.

I started looking at it myself, but Rust really is a weird language, can't really get my head around it :-/

@MarcelCoding
Copy link
Owner

MarcelCoding commented Jul 1, 2022

No problem xd I did it: 03373e6

I am now extracting the given_name, middle_name and the family_name and concatenating these using a space. I added an additional fallback to the username.

I always use the default locale:

{
   "given_name": "Alice",
   "given_name#en" : "Alice1",
   "given_name#bg" : "Алис"
}

Here the selected value would be Alice.

Could you give it a try?

@DanielMalmgren
Copy link
Contributor Author

Well, you're the man, that works perfectly! Even nicer than I suggested, I had no thought about neither localised names nor middle names (which is something we don't use here).

I now have a proof-of-concept-solution that means my organization can retire our aging Skype For Business, which is only used for video conferencing. If you ever get to Sweden, contact me and I'll at least buy you a beer :-P

One small thing you ought to do is update the README.md with some info about the supported attributes, now that there's more of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants