@@ -27,34 +27,51 @@ pub mod sql;
2727#[ cfg_attr( test, mockall:: automock) ]
2828#[ async_trait]
2929pub trait IdentityBackend : Send + Sync {
30- /// Authenticate a user by a password .
31- async fn authenticate_by_password (
30+ /// Add the user to the group .
31+ async fn add_user_to_group < ' a > (
3232 & self ,
3333 state : & ServiceState ,
34- auth : & UserPasswordAuthRequest ,
35- ) -> Result < AuthenticatedInfo , IdentityProviderError > ;
34+ user_id : & ' a str ,
35+ group_id : & ' a str ,
36+ ) -> Result < ( ) , IdentityProviderError > ;
3637
37- /// List Users .
38- async fn list_users (
38+ /// Add the user to the group with expiration .
39+ async fn add_user_to_group_expiring < ' a > (
3940 & self ,
4041 state : & ServiceState ,
41- params : & UserListParameters ,
42- ) -> Result < Vec < UserResponse > , IdentityProviderError > ;
42+ user_id : & ' a str ,
43+ group_id : & ' a str ,
44+ idp_id : & ' a str ,
45+ ) -> Result < ( ) , IdentityProviderError > ;
4346
44- /// Get single user by ID .
45- async fn get_user < ' a > (
47+ /// Add user group membership relations .
48+ async fn add_users_to_groups < ' a > (
4649 & self ,
4750 state : & ServiceState ,
48- user_id : & ' a str ,
49- ) -> Result < Option < UserResponse > , IdentityProviderError > ;
51+ memberships : Vec < ( & ' a str , & ' a str ) > ,
52+ ) -> Result < ( ) , IdentityProviderError > ;
5053
51- /// Find federated user by IDP and Unique ID .
52- async fn find_federated_user < ' a > (
54+ /// Add expiring user group membership relations .
55+ async fn add_users_to_groups_expiring < ' a > (
5356 & self ,
5457 state : & ServiceState ,
58+ memberships : Vec < ( & ' a str , & ' a str ) > ,
5559 idp_id : & ' a str ,
56- unique_id : & ' a str ,
57- ) -> Result < Option < UserResponse > , IdentityProviderError > ;
60+ ) -> Result < ( ) , IdentityProviderError > ;
61+
62+ /// Authenticate a user by a password.
63+ async fn authenticate_by_password (
64+ & self ,
65+ state : & ServiceState ,
66+ auth : & UserPasswordAuthRequest ,
67+ ) -> Result < AuthenticatedInfo , IdentityProviderError > ;
68+
69+ /// Create group.
70+ async fn create_group (
71+ & self ,
72+ state : & ServiceState ,
73+ group : GroupCreate ,
74+ ) -> Result < Group , IdentityProviderError > ;
5875
5976 /// Create user.
6077 async fn create_user (
@@ -63,19 +80,19 @@ pub trait IdentityBackend: Send + Sync {
6380 user : UserCreate ,
6481 ) -> Result < UserResponse , IdentityProviderError > ;
6582
66- /// Delete user .
67- async fn delete_user < ' a > (
83+ /// Delete group by ID .
84+ async fn delete_group < ' a > (
6885 & self ,
6986 state : & ServiceState ,
70- user_id : & ' a str ,
87+ group_id : & ' a str ,
7188 ) -> Result < ( ) , IdentityProviderError > ;
7289
73- /// List groups .
74- async fn list_groups (
90+ /// Delete user .
91+ async fn delete_user < ' a > (
7592 & self ,
7693 state : & ServiceState ,
77- params : & GroupListParameters ,
78- ) -> Result < Vec < Group > , IdentityProviderError > ;
94+ user_id : & ' a str ,
95+ ) -> Result < ( ) , IdentityProviderError > ;
7996
8097 /// Get single group by ID.
8198 async fn get_group < ' a > (
@@ -84,58 +101,48 @@ pub trait IdentityBackend: Send + Sync {
84101 group_id : & ' a str ,
85102 ) -> Result < Option < Group > , IdentityProviderError > ;
86103
87- /// Create group.
88- async fn create_group (
89- & self ,
90- state : & ServiceState ,
91- group : GroupCreate ,
92- ) -> Result < Group , IdentityProviderError > ;
93-
94- /// Delete group by ID.
95- async fn delete_group < ' a > (
104+ /// Get single user by ID.
105+ async fn get_user < ' a > (
96106 & self ,
97107 state : & ServiceState ,
98- group_id : & ' a str ,
99- ) -> Result < ( ) , IdentityProviderError > ;
108+ user_id : & ' a str ,
109+ ) -> Result < Option < UserResponse > , IdentityProviderError > ;
100110
101- /// List groups a user is member of .
102- async fn list_groups_of_user < ' a > (
111+ /// Get single user by ID .
112+ async fn get_user_domain_id < ' a > (
103113 & self ,
104114 state : & ServiceState ,
105115 user_id : & ' a str ,
106- ) -> Result < Vec < Group > , IdentityProviderError > ;
116+ ) -> Result < Option < String > , IdentityProviderError > ;
107117
108- /// Add the user to the group .
109- async fn add_user_to_group < ' a > (
118+ /// Find federated user by IDP and Unique ID .
119+ async fn find_federated_user < ' a > (
110120 & self ,
111121 state : & ServiceState ,
112- user_id : & ' a str ,
113- group_id : & ' a str ,
114- ) -> Result < ( ) , IdentityProviderError > ;
122+ idp_id : & ' a str ,
123+ unique_id : & ' a str ,
124+ ) -> Result < Option < UserResponse > , IdentityProviderError > ;
115125
116- /// Add the user to the group with expiration .
117- async fn add_user_to_group_expiring < ' a > (
126+ /// List groups .
127+ async fn list_groups (
118128 & self ,
119129 state : & ServiceState ,
120- user_id : & ' a str ,
121- group_id : & ' a str ,
122- idp_id : & ' a str ,
123- ) -> Result < ( ) , IdentityProviderError > ;
130+ params : & GroupListParameters ,
131+ ) -> Result < Vec < Group > , IdentityProviderError > ;
124132
125- /// Add user group membership relations .
126- async fn add_users_to_groups < ' a > (
133+ /// List Users .
134+ async fn list_users (
127135 & self ,
128136 state : & ServiceState ,
129- memberships : Vec < ( & ' a str , & ' a str ) > ,
130- ) -> Result < ( ) , IdentityProviderError > ;
137+ params : & UserListParameters ,
138+ ) -> Result < Vec < UserResponse > , IdentityProviderError > ;
131139
132- /// Add expiring user group membership relations .
133- async fn add_users_to_groups_expiring < ' a > (
140+ /// List groups a user is member of .
141+ async fn list_groups_of_user < ' a > (
134142 & self ,
135143 state : & ServiceState ,
136- memberships : Vec < ( & ' a str , & ' a str ) > ,
137- idp_id : & ' a str ,
138- ) -> Result < ( ) , IdentityProviderError > ;
144+ user_id : & ' a str ,
145+ ) -> Result < Vec < Group > , IdentityProviderError > ;
139146
140147 /// Remove the user from the group.
141148 async fn remove_user_from_group < ' a > (
0 commit comments