From 9e59f188de7c756cae5096cd3f4aa46a3537bb1d Mon Sep 17 00:00:00 2001 From: mattb18 Date: Tue, 24 Jan 2023 20:39:57 +0000 Subject: [PATCH] Update README example to use displayName attribute Great package, just went through the getting started docs and noticed an issue. Looks like the assertion attributes returned from https://samltest.id have changed and **cn** is no longer included, meaning that the hello function does not return a name as expected. Example JWT using the demo: ``` { "aud": "http://localhost:8000", "exp": 1674593145, "iat": 1674589545, "iss": "http://localhost:8000", "nbf": 1674589545, "sub": "AAdzZWNyZXQx7NxVYHJFFRw4UvKpGl1OryGBhvN55fPjUn0gxghj1hxVn7EMYUpfVlUxOqJtDaM71rCefli2ws2KUxlNkUUZ9t/vftoJKeM7PyrPHpMP8KUdr4VWD0LvkvRv1yaN1BuNu69jopqm", "attr": { "SessionIndex": [ "_1aab96ca96e7326043c3709b75f9043c" ], "displayName": [ "Rick Sanchez" ], "eduPersonEntitlement": [ "urn:mace:dir:entitlement:common-lib-terms" ], "givenName": [ "Rick" ], "mail": [ "rsanchez@samltest.id" ], "role": [ "manager@Samltest.id" ], "sn": [ "Sanchez" ], "telephoneNumber": [ "+1-555-555-5515" ], "uid": [ "rick" ], "urn:oasis:names:tc:SAML:attribute:subject-id": [ "rsanchez@samltest.id" ] }, "saml-session": true } ``` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71f24786..c0b98058 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ import ( ) func hello(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "Hello, %s!", samlsp.AttributeFromContext(r.Context(), "cn")) + fmt.Fprintf(w, "Hello, %s!", samlsp.AttributeFromContext(r.Context(), "displayName")) } func main() {