@@ -638,6 +638,18 @@ func (a *ACL) UpsertTokens(args *structs.ACLTokenUpsertRequest, reply *structs.A
638
638
return err
639
639
}
640
640
641
+ return a .upsertTokens (args , reply , stateSnapshot )
642
+ }
643
+
644
+ // upsertTokens is a method that contains common token upsertion logic without
645
+ // the RPC authentication, metrics, etc. Used in other RPC calls that require to
646
+ // upsert tokens.
647
+ func (a * ACL ) upsertTokens (
648
+ args * structs.ACLTokenUpsertRequest ,
649
+ reply * structs.ACLTokenUpsertResponse ,
650
+ stateSnapshot * state.StateSnapshot ,
651
+ ) error {
652
+
641
653
// Validate each token
642
654
for idx , token := range args .Tokens {
643
655
@@ -2773,7 +2785,7 @@ func (a *ACL) OIDCCompleteAuth(
2773
2785
2774
2786
var tokenUpsertReply structs.ACLTokenUpsertResponse
2775
2787
2776
- if err := a .srv . RPC ( structs . ACLUpsertTokensRPCMethod , & tokenUpsertRequest , & tokenUpsertReply ); err != nil {
2788
+ if err := a .upsertTokens ( & tokenUpsertRequest , & tokenUpsertReply , stateSnapshot ); err != nil {
2777
2789
return err
2778
2790
}
2779
2791
@@ -2921,7 +2933,7 @@ func (a *ACL) Login(args *structs.ACLLoginRequest, reply *structs.ACLLoginRespon
2921
2933
2922
2934
var tokenUpsertReply structs.ACLTokenUpsertResponse
2923
2935
2924
- if err := a .srv . RPC ( structs . ACLUpsertTokensRPCMethod , & tokenUpsertRequest , & tokenUpsertReply ); err != nil {
2936
+ if err := a .upsertTokens ( & tokenUpsertRequest , & tokenUpsertReply , stateSnapshot ); err != nil {
2925
2937
return err
2926
2938
}
2927
2939
0 commit comments