@@ -25,7 +25,6 @@ import (
25
25
"gotest.tools/golden"
26
26
27
27
"github.com/beevik/etree"
28
- "github.com/golang-jwt/jwt/v4"
29
28
dsig "github.com/russellhaering/goxmldsig"
30
29
31
30
"github.com/crewjam/saml/logger"
@@ -104,7 +103,6 @@ func NewIdentityProviderTest(t *testing.T, opts ...idpTestOpts) *IdentityProvide
104
103
rv , _ := time .Parse ("Mon Jan 2 15:04:05 MST 2006" , "Mon Dec 1 01:57:09 UTC 2015" )
105
104
return rv
106
105
}
107
- jwt .TimeFunc = TimeNow
108
106
RandReader = & testRandomReader {} // TODO(ross): remove this and use the below generator
109
107
xmlenc .RandReader = rand .New (rand .NewSource (0 )) //nolint:gosec // deterministic random numbers for tests
110
108
@@ -485,7 +483,6 @@ func TestIDPCanValidate(t *testing.T) {
485
483
"</AuthnRequest>" ),
486
484
}
487
485
assert .Check (t , is .Error (req .Validate (), "cannot find assertion consumer service: file does not exist" ))
488
-
489
486
}
490
487
491
488
func TestIDPMakeAssertion (t * testing.T ) {
@@ -592,94 +589,93 @@ func TestIDPMakeAssertion(t *testing.T) {
592
589
})
593
590
assert .Check (t , err )
594
591
595
- expectedAttributes :=
596
- []Attribute {
597
- {
598
- FriendlyName : "uid" ,
599
- Name : "urn:oid:0.9.2342.19200300.100.1.1" ,
600
- NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
601
- Values : []AttributeValue {
602
- {
603
- Type : "xs:string" ,
604
- Value : "alice" ,
605
- },
592
+ expectedAttributes := []Attribute {
593
+ {
594
+ FriendlyName : "uid" ,
595
+ Name : "urn:oid:0.9.2342.19200300.100.1.1" ,
596
+ NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
597
+ Values : []AttributeValue {
598
+ {
599
+ Type : "xs:string" ,
600
+ Value : "alice" ,
606
601
},
607
602
},
608
- {
609
- FriendlyName : "mail" ,
610
- Name : "urn:oid:0.9.2342.19200300.100.1.3 " ,
611
- NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri " ,
612
- Values : [] AttributeValue {
613
- {
614
- Type : "xs:string" ,
615
-
616
- } ,
603
+ },
604
+ {
605
+ FriendlyName : "mail " ,
606
+ Name : "urn:oid:0.9.2342.19200300.100.1.3 " ,
607
+ NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
608
+ Values : [] AttributeValue {
609
+ {
610
+ Type : "xs:string " ,
611
+
617
612
},
618
613
},
619
- {
620
- FriendlyName : "eduPersonPrincipalName" ,
621
- Name : "urn:oid:1.3.6.1.4.1.5923.1.1.1.6 " ,
622
- NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri " ,
623
- Values : [] AttributeValue {
624
- {
625
- Type : "xs:string" ,
626
-
627
- } ,
614
+ },
615
+ {
616
+ FriendlyName : "eduPersonPrincipalName " ,
617
+ Name : "urn:oid:1.3.6.1.4.1.5923.1.1.1.6 " ,
618
+ NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
619
+ Values : [] AttributeValue {
620
+ {
621
+ Type : "xs:string " ,
622
+
628
623
},
629
624
},
630
- {
631
- FriendlyName : "sn" ,
632
- Name : "urn:oid:2.5.4.4 " ,
633
- NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri " ,
634
- Values : [] AttributeValue {
635
- {
636
- Type : "xs:string" ,
637
- Value : "Smith " ,
638
- } ,
625
+ },
626
+ {
627
+ FriendlyName : "sn " ,
628
+ Name : "urn:oid:2.5.4.4 " ,
629
+ NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
630
+ Values : [] AttributeValue {
631
+ {
632
+ Type : "xs:string " ,
633
+ Value : "Smith" ,
639
634
},
640
635
},
641
- {
642
- FriendlyName : "givenName" ,
643
- Name : "urn:oid:2.5.4.42 " ,
644
- NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri " ,
645
- Values : [] AttributeValue {
646
- {
647
- Type : "xs:string" ,
648
- Value : "Alice " ,
649
- } ,
636
+ },
637
+ {
638
+ FriendlyName : "givenName " ,
639
+ Name : "urn:oid:2.5.4.42 " ,
640
+ NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
641
+ Values : [] AttributeValue {
642
+ {
643
+ Type : "xs:string " ,
644
+ Value : "Alice" ,
650
645
},
651
646
},
652
- {
653
- FriendlyName : "cn" ,
654
- Name : "urn:oid:2.5.4.3 " ,
655
- NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri " ,
656
- Values : [] AttributeValue {
657
- {
658
- Type : "xs:string" ,
659
- Value : "Alice Smith " ,
660
- } ,
647
+ },
648
+ {
649
+ FriendlyName : "cn " ,
650
+ Name : "urn:oid:2.5.4.3 " ,
651
+ NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
652
+ Values : [] AttributeValue {
653
+ {
654
+ Type : "xs:string " ,
655
+ Value : "Alice Smith" ,
661
656
},
662
657
},
663
- {
664
- FriendlyName : "eduPersonAffiliation" ,
665
- Name : "urn:oid:1.3.6.1.4.1.5923.1.1.1.1 " ,
666
- NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri " ,
667
- Values : [] AttributeValue {
668
- {
669
- Type : "xs:string" ,
670
- Value : "Users " ,
671
- } ,
672
- {
673
- Type : "xs:string" ,
674
- Value : "Administrators " ,
675
- } ,
676
- {
677
- Type : "xs:string" ,
678
- Value : "♀ " ,
679
- } ,
658
+ },
659
+ {
660
+ FriendlyName : "eduPersonAffiliation " ,
661
+ Name : "urn:oid:1.3.6.1.4.1.5923.1.1.1.1 " ,
662
+ NameFormat : "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ,
663
+ Values : [] AttributeValue {
664
+ {
665
+ Type : "xs:string " ,
666
+ Value : "Users" ,
667
+ },
668
+ {
669
+ Type : "xs:string " ,
670
+ Value : "Administrators" ,
671
+ },
672
+ {
673
+ Type : "xs:string " ,
674
+ Value : "♀" ,
680
675
},
681
676
},
682
- }
677
+ },
678
+ }
683
679
assert .Check (t , is .DeepEqual (expectedAttributes , req .Assertion .AttributeStatements [0 ].Attributes ))
684
680
}
685
681
@@ -1044,7 +1040,8 @@ func TestIDPRequestedAttributes(t *testing.T) {
1044
1040
},
1045
1041
},
1046
1042
},
1047
- }}}
1043
+ },
1044
+ }}
1048
1045
assert .Check (t , is .DeepEqual (expectedAttributes , req .Assertion .AttributeStatements ))
1049
1046
}
1050
1047
0 commit comments