TheHive-Project / TheHive-Project/Cortex

Azure oauth2 sso

Open
#331 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.6k
Forks
264
PR merge metrics
No merged PRs in 30d

Description

Hi,

I try configure the Azure oauth2 with sso for Cortex authentication.
I have created Azure APP registration.

Some one have same issue?

`auth {
provider = [local,oauth2]
oauth2 {
# URL of the authorization server
clientId = "[DELETED]"
clientSecret = "[DELETED]"
redirectUri = "https://[DELETED]/api/ssoLogin"
responseType = "code"
grantType = "authorization_code"

	# URL from where to get the access token
	authorizationUrl = "https://login.microsoftonline.com/[DELETED]/oauth2/v2.0/authorize"
	tokenUrl = "https://login.microsoftonline.com/[DELETED]/oauth2/v2.0/token"

	# The endpoint from which to obtain user details using the OAuth token, after successful login
	userUrl = "https://graph.microsoft.com/oidc/userinfo""
	scope = ["openid email profile offline_access User.Read"]

}
sso {
	# Autocreate user in database?
	autocreate = false

	# Autoupdate its profile and roles?
	autoupdate = false

	# Autologin user using SSO?
	#autologin = false
	mapper = "simple"
	attributes {
	  login = "email"
	  name: "displayName"
	  roles = "role"
	}
	defaultRoles = ["read"]
	defaultOrganization = "[DELETED]"
	}

}
`

And the log give the following result:
2021-01-26 19:26:14,812 [DEBUG] from org.elastic4play.services.auth.MultiAuthSrv in application-akka.actor.default-dispatcher-18 - oauth2 AuthenticationError OAuth2 authentication failure: User info fails: 2021-01-26 19:26:14,812 [INFO] from org.thp.cortex.services.ErrorHandler in application-akka.actor.default-dispatcher-18 - GET /api/ssoLogin?code=0.ARAAURdHXXWWjUKRe3D0T5YwsOVrmVDjzaRDou8AVJdKk8oQAAA.AQABAAIAAABeStGSRwwnTq2vHplZ9KL42b_uk5am4BfdP6yD3Fhr12eru5nFHHlPjPlO7g-5rk0yqx2YNTBjNaH_jfg6A2qan2Cr0oAsivarn-v1-fJFaC6HlswWNgI9OCT_816rY1oVqTmDvg-TCHKZfSLWilxGL2nMoYljSYe4z-09E5k5h7R_6WGpxFp_xVSoljseH9P9dIYOxZRTeGzeHoHLQ6yoweCJjEWXubTZOuBi9OhYg7CARw3op5XyUtjqgu8h-KrJV1lXR_1FFyV7eC3mYSZY4OGQQGMx-rmSzcZB6XZRrGRAI28UZ3ObmQc5cOecWJsBuyQQXYPv1NtYm7Z1USeK9OgAar9Q0pUuACuYcWxRBTvLmiBmvBnmi2X9t3FvQpex1yxuhbdGypLtolo4MXWQQzQ6pcCvjI7tyuz050n_XVu-dxvbQbPbq6mUAt_AfPxClnhxMmvaS0yt27Ln3Rdz6y5CggmTuebBeU-sicMCcXjmNpXnftNoCOdY-dpGSzIwqvNHVHFMS4xuOjXle0e4Xa3NB8dwU1QHvRuU3mE_6P3N1hIm2B3Bbi1CNn7gdlM0YXEBPXTDd6AD2K1KCsEI9ZiSqvIdyKPPl753BqJSoLf-DRk-C9Qw13oImktSyO4NZxLBPEPUE4ZoOr5jtaHXucKnfAIRcGthVah6sSOkTaneB52gilv8vpU0YlkQdB3c0jC4y_zDzn9cBjPc_w6DBJVmVY4JP6StY9bH5ropGoINegX6mM26_b4BNXqjaS4YgCdbwdJJ5P2U_IZ6fxKx_WV0TZc3f4xoOJ39yWzuZW-SQaXBqpbNlM5YmNRiWEQgAA&state=7764511b-0529-4839-8111-cda9871adead&session_state=6dfe1df0-4345-4a06-8fa1-0dbc4ef33387 returned 401

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied OAuth2 configuration and the authentication log showing that the user-info request fails with HTTP 401. Reproduce the Azure SSO flow and inspect the returned user-info response and its request assumptions. Done means Azure users can complete SSO and Cortex accepts the returned identity.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
authentication, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.