Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revoke token on wrong auth #8

Open
ivan1986 opened this issue Jul 22, 2015 · 4 comments
Open

Revoke token on wrong auth #8

ivan1986 opened this issue Jul 22, 2015 · 4 comments

Comments

@ivan1986
Copy link

if login on email have not access can not relogin on other
if add in -- If no whitelist or blacklist, match on domain

https.request("https://accounts.google.com/o/oauth2/revoke","token="..access_token)

before return 401
all ok

maybe add option?

@ivan1986
Copy link
Author

  -- If no whitelist or blacklist, match on domain
  if not whitelist and not blacklist and domain then
    if oauth_domain ~= domain then
      if debug then
        ngx.log(ngx.ERR, "DEBUG: "..email.." not in "..domain)
      end

      https.request("https://accounts.google.com/o/oauth2/revoke","token="..access_token)

      return ngx.exit(ngx.HTTP_UNAUTHORIZED)
    end
  end

  if whitelist then
    if not string.find(" " .. whitelist .. " ", " " .. email .. " ") then
      if debug then
        ngx.log(ngx.ERR, "DEBUG: "..email.." not in whitelist")
      end

      https.request("https://accounts.google.com/o/oauth2/revoke","token="..access_token)

      return ngx.exit(ngx.HTTP_UNAUTHORIZED)
    end
  end

  if blacklist then
    if string.find(" " .. blacklist .. " ", " " .. email .. " ") then
      if debug then
        ngx.log(ngx.ERR, "DEBUG: "..email.." in blacklist")
      end

      https.request("https://accounts.google.com/o/oauth2/revoke","token="..access_token)

      return ngx.exit(ngx.HTTP_UNAUTHORIZED)
    end
  end

@awestendorf
Copy link
Member

That sounds reasonable. Can you put that into a PR?

@ivan1986
Copy link
Author

ivan1986 commented Oct 3, 2016

@awestendorf hmmm
ping?

@awestendorf
Copy link
Member

Apologies, I forgot all about this. I'll try to test it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants