@@ -38,13 +38,14 @@ type Session struct {
38
38
NameIDFormat string
39
39
SubjectID string
40
40
41
- Groups []string
42
- UserName string
43
- UserEmail string
44
- UserCommonName string
45
- UserSurname string
46
- UserGivenName string
47
- UserScopedAffiliation string
41
+ Groups []string
42
+ UserName string
43
+ UserEmail string
44
+ UserCommonName string
45
+ UserSurname string
46
+ UserGivenName string
47
+ UserScopedAffiliation string
48
+ EduPersonPrincipalName string `json:",omitempty"`
48
49
49
50
CustomAttributes []Attribute
50
51
}
@@ -662,13 +663,33 @@ func (DefaultAssertionMaker) MakeAssertion(req *IdpAuthnRequest, session *Sessio
662
663
}
663
664
664
665
if session .UserEmail != "" {
666
+ attributes = append (attributes , Attribute {
667
+ FriendlyName : "mail" ,
668
+ Name : "urn:oid:0.9.2342.19200300.100.1.3" ,
669
+ NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
670
+ Values : []AttributeValue {{
671
+ Type : "xs:string" ,
672
+ Value : session .UserEmail ,
673
+ }},
674
+ })
675
+ }
676
+ if session .EduPersonPrincipalName != "" || session .UserEmail != "" {
677
+ value := session .EduPersonPrincipalName
678
+ if value == "" {
679
+ // We used to set eduPersonPrincipalName (urn:oid:1.3.6.1.4.1.5923.1.1.1.6)
680
+ // to the value of session.UserEmail. It is more correct to set
681
+ // mail (urn:oid:0.9.2342.19200300.100.1.3). To avoid breaking things,
682
+ // we preserve the former behavior.
683
+ value = session .UserEmail
684
+ }
685
+
665
686
attributes = append (attributes , Attribute {
666
687
FriendlyName : "eduPersonPrincipalName" ,
667
688
Name : "urn:oid:1.3.6.1.4.1.5923.1.1.1.6" ,
668
689
NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
669
690
Values : []AttributeValue {{
670
691
Type : "xs:string" ,
671
- Value : session . UserEmail ,
692
+ Value : value ,
672
693
}},
673
694
})
674
695
}
@@ -709,7 +730,7 @@ func (DefaultAssertionMaker) MakeAssertion(req *IdpAuthnRequest, session *Sessio
709
730
710
731
if session .UserScopedAffiliation != "" {
711
732
attributes = append (attributes , Attribute {
712
- FriendlyName : "uid " ,
733
+ FriendlyName : "scopedAffiliation " ,
713
734
Name : "urn:oid:1.3.6.1.4.1.5923.1.1.1.9" ,
714
735
NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
715
736
Values : []AttributeValue {{
0 commit comments