<s> from conans . server . rest . controllers . controller import Controller <EOL> from conans . errors import AuthenticationException , ForbiddenException <EOL> from conans . server . service . user_service import UserService <EOL> class UsersController ( Controller ) : <EOL> """<STR_LIT>""" <EOL> def attach_to ( self , app ) : <EOL> @ app . route ( self . route + '<STR_LIT>' , method = [ "<STR_LIT:GET>" ] ) <EOL> def authenticate ( http_basic_credentials ) : <EOL> if not http_basic_credentials : <EOL> raise AuthenticationException ( "<STR_LIT>" ) <EOL> user_service = UserService ( app . authenticator , <EOL> app . credentials_manager ) <EOL> token = user_service . authenticate ( http_basic_credentials . user , <EOL> http_basic_credentials . password ) <EOL> return token <EOL> @ app . route ( self . route + '<STR_LIT>' , method = [ "<STR_LIT:GET>" ] ) <EOL> def check_credentials ( auth_user ) : <EOL> """<STR_LIT>""" <EOL> if not auth_user : <EOL> raise ForbiddenException ( "<STR_LIT>" ) <EOL> return auth_user </s>
