Skip to content

custom exchange request attribute/header #533

Closed as not planned
Closed as not planned
@lunicon

Description

@lunicon

Cant send extra attribute in password grant

config.PasswordCredentialsToken(ctx, username, password)

So, we have to use Echange to send client_ip

token, err = config.Exchange(ctx, "",
  oauth2.SetAuthURLParam("grant_type", "password"),
  oauth2.SetAuthURLParam("username", username),
  oauth2.SetAuthURLParam("password", password),
  oauth2.SetAuthURLParam("scope", strings.Join(config.Scopes, " ")),
  oauth2.SetAuthURLParam("client_ip", clientIP))

I made http middleware which convert basic authentication to openid token for temporary backward compatibility
server extention read clientIP from attribute.

Server support forwarded request https://github.com/keycloak/keycloak-documentation/blob/master/server_installation/topics/clustering/load-balancer.adoc
But I have no idea how to set exchange request headers

req.Header.Set("X-Forwarded-Proto", "https");
req.Header.Set("X-Forwarded-For", clientIP);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions