| 63 | raise ParamException("%s is not a valid auth mode" % cfg.CONF.auth.mode) |
| 64 | |
| 65 | def post(self, request, **kwargs): |
| 66 | headers = {} |
| 67 | if "x-forwarded-for" in kwargs: |
| 68 | headers["x-forwarded-for"] = kwargs.pop("x-forwarded-for") |
| 69 | |
| 70 | remote_user = kwargs.pop("remote_user", None) |
| 71 | if not remote_user and "x-forwarded-user" in kwargs: |
| 72 | remote_user = kwargs.pop("x-forwarded-user", None) |
| 73 | |
| 74 | authorization = kwargs.pop("authorization", None) |
| 75 | if authorization: |
| 76 | authorization = tuple(authorization.split(" ")) |
| 77 | |
| 78 | token = self.handler.handle_auth( |
| 79 | request=request, |
| 80 | headers=headers, |
| 81 | remote_addr=kwargs.pop("remote_addr", None), |
| 82 | remote_user=remote_user, |
| 83 | authorization=authorization, |
| 84 | **kwargs, |
| 85 | ) |
| 86 | return process_successful_response(token=token) |
| 87 | |
| 88 | |
| 89 | def process_successful_response(token): |