File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -138,6 +138,10 @@ def is_authenticated(self) -> bool:
138138 def display_name (self ) -> str :
139139 return self .username
140140
141+ @property
142+ def identity (self ) -> str :
143+ return self .username
144+
141145
142146class UnauthenticatedUser (BaseUser ):
143147 @property
@@ -147,3 +151,7 @@ def is_authenticated(self) -> bool:
147151 @property
148152 def display_name (self ) -> str :
149153 return ""
154+
155+ @property
156+ def identity (self ) -> str :
157+ return ""
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ def homepage(request: Request) -> JSONResponse:
4747 {
4848 "authenticated" : request .user .is_authenticated ,
4949 "user" : request .user .display_name ,
50+ "identity" : request .user .identity ,
5051 }
5152 )
5253
@@ -213,11 +214,11 @@ def test_user_interface(test_client_factory: TestClientFactory) -> None:
213214 with test_client_factory (app ) as client :
214215 response = client .get ("/" )
215216 assert response .status_code == 200
216- assert response .json () == {"authenticated" : False , "user" : "" }
217+ assert response .json () == {"authenticated" : False , "user" : "" , "identity" : "" }
217218
218219 response = client .get ("/" , auth = ("tomchristie" , "example" ))
219220 assert response .status_code == 200
220- assert response .json () == {"authenticated" : True , "user" : "tomchristie" }
221+ assert response .json () == {"authenticated" : True , "user" : "tomchristie" , "identity" : "tomchristie" }
221222
222223
223224def test_authentication_required (test_client_factory : TestClientFactory ) -> None :
You can’t perform that action at this time.
0 commit comments