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

Does it work it with ADFS 2012R2 (Active Directory Federation Services)? #77

Closed
rerime opened this issue Feb 18, 2019 · 7 comments
Closed
Labels

Comments

@rerime
Copy link

rerime commented Feb 18, 2019

Does it work it with ADFS 2012R2 or 2016 (Active Directory Federation Services)?
OAUTH 2.0?
Please provide documentation how to setup.

@rerime rerime changed the title Does it work it with ADFS (Active Directory Federation Services)? Does it work it with ADFS 2012R2 (Active Directory Federation Services)? Feb 18, 2019
@bnfinet
Copy link
Member

bnfinet commented Feb 18, 2019

@simongottschlag has recently contributed #68 for ADFS support.

I'm uncertain about support for ADFS 2012R2 specifically but I think it should work with an oauth.provider: oidc config such as...

oauth:
  provider: oidc
  client_id: yourclientId
  client_secret: ***
  auth_url: https://adfs.example.com/adfs/oauth2/authorize/
  token_url: https://adfs.example.com/adfs/oauth2/token/
  user_info_url: https://adfs.example.com/adfs/userinfo
  scopes:
    - openid
    - email
    - profile
  callback_url: https://auth.example.com/auth

@simongottschlag does that look right to you? ^^

See PR #68 and issue #65 for further discussion.

@rerime please do let us know if that works. I'll leave this open for now.

@simongottschlag
Copy link
Contributor

simongottschlag commented Feb 19, 2019

Hi,

The following works:

vouch:
  logLevel: warning
  listen: 0.0.0.0
  port: 80
  AllowAllUsers: true
  cookie: 
    name: VouchCookie
    domain: example.com
    secure: true
    httpOnly: true
  headers:
    jwt: X-Vouch-Token
    querystring: access_token
    redirect: X-Vouch-Requested-URI
  session:
    name: VouchSession
  jwt:
    secret: secret
    maxAge: 59
oauth:
  provider: adfs
  client_id: clientId
  client_secret: secret
  auth_url: https://adfs.example.com/adfs/oauth2/authorize/
  token_url: https://adfs.example.com/adfs/oauth2/token/
  scopes:
    - openid
    - email
    - profile
  callback_url: https://vouch.example.com/auth

Only tested with ADFS 2016 (v4). You can try the following:

$name = 'vouch'
$environment = 'dev'
$vouchProxyAddr = "https://auth.example.com/auth"

$ClientRoleIdentifier = "$name-$environment".ToLower()
$ServerRoleIdentifier = @(
    "$name`://$environment",
    $vouchProxyAddr
)

New-AdfsApplicationGroup -Name "$ClientRoleIdentifier" -ApplicationGroupIdentifier "$ClientRoleIdentifier"
$ADFSApp = Add-AdfsServerApplication -Name "$ClientRoleIdentifier - Server application" -ApplicationGroupIdentifier "$ClientRoleIdentifier" -RedirectUri $ServerRoleIdentifier -Identifier "$ClientRoleIdentifier" -GenerateClientSecret

$params = @{
    Name="$ClientRoleIdentifier - Web API"
    ApplicationGroupIdentifier="$ClientRoleIdentifier"
    Identifier=$ServerRoleIdentifier
    IssueOAuthRefreshTokensTo="AllDevices"
    RefreshTokenProtectionEnabled=$false
    AccessControlPolicyName="Permit specific group"
    AccessControlPolicyParameters=@{
        GroupParameter=$LoginGroupName
    }
}

Add-AdfsWebApiApplication @params

Grant-AdfsApplicationPermission -ClientRoleIdentifier $ClientRoleIdentifier -ServerRoleIdentifier $ServerRoleIdentifier[0] -ScopeNames @('allatclaims','profile','openid')
Write-Output "`r`nPlease write down and save the following Client Secret: $($ADFSApp.ClientSecret)`r`n"

Please note that I've shortened the above down a bit, so may have missed something. I'm usually issuing claims based on groups as well for kubernetes roles - but doesn't really matter in this case.

@rerime
Copy link
Author

rerime commented Feb 21, 2019

@simongottschlag All builds are failed.
https://travis-ci.com/vouch/vouch-proxy/builds
Not sure where release/stable version.

@bnfinet
Copy link
Member

bnfinet commented Feb 21, 2019 via email

@bnfinet
Copy link
Member

bnfinet commented Feb 25, 2019

@rerime do you have any other questions? If not could you please close this issue?

@rerime
Copy link
Author

rerime commented Feb 25, 2019

I was trying to run oauth with Azure AD with the followng config file:

provider: oidc
client_id: 
client_secret: 
auth_url: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize 
token_url: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
scopes:
  - openid
  - email
callback_url: https://myapp.example.org/auth

Start docker with
docker run -d -p 9090:9090 --name vouch-proxy -v ${PWD}/config:/config -v ${PWD}/data:/data voucher/vouch-proxy

docker logs {container_id}:

time="2019-02-25T14:53:59Z" level=warning msg="generating random jwt.secret and storing it in config/secret"
time="2019-02-25T14:53:59Z" level=warning msg="generating random session.key"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x804e47]

goroutine 1 [running]:
github.com/vouch/vouch-proxy/pkg/cfg.setDefaults()
        /go/src/github.com/vouch/vouch-proxy/pkg/cfg/cfg.go:403 +0x967
github.com/vouch/vouch-proxy/pkg/cfg.init.0()
        /go/src/github.com/vouch/vouch-proxy/pkg/cfg/cfg.go:152 +0x143

Could you provide valid config in example or I can verify it by myself.

@bnfinet
Copy link
Member

bnfinet commented Feb 25, 2019

Is that the entire config? Could you please take a look at the examples in the ./config directory of this code base.

@bnfinet bnfinet closed this as completed Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants