-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Delegated authorization using Microsoft Graph (SDK) #128396
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
Merged
jfreden
merged 73 commits into
elastic:main
from
richard-dennehy:microsoft-graph-implementation-sdk
Jun 12, 2025
Merged
Changes from all commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
a4d85f6
basic MS graph authz implementation
richard-dennehy cfd2906
[CI] Auto commit changes from spotless
9182858
move client_secret to keystore
richard-dennehy 34b6276
use JSONObjectUtils for parsing json
richard-dennehy 11cd43a
(not working) attempt to use official graph SDK
richard-dennehy aae596e
WIP at least it runs; if only it didn't mysteriously hang
richard-dennehy 5c337b2
WIP unit tests (for debugging the plugin)
richard-dennehy 108f462
WIP at least it works against real azure
richard-dennehy c39c3f6
document assorted hacks required to get this thing working
richard-dennehy 5984ada
passing IT tests
richard-dennehy 219aa17
slight clean up
richard-dennehy c230ed6
[CI] Auto commit changes from spotless
6d907e5
update comment about mystery includes to be more accurate
richard-dennehy 0b9a449
[CI] Auto commit changes from spotless
451a553
clean up some TODOs
richard-dennehy 85d123a
[CI] Auto commit changes from spotless
a0bba42
implement unit tests
richard-dennehy bec682e
test retry handling
richard-dennehy 3798b98
[CI] Auto commit changes from spotless
4552b3e
fetch transitive group membership
richard-dennehy d1c22bf
[CI] Auto commit changes from spotless
ab0c69d
support multiple test users in graph http fixture
richard-dennehy 227e0d9
[CI] Auto commit changes from spotless
668c441
move manifest patching into Utils.patchJar
richard-dennehy be296be
add test for concurrent login
richard-dennehy 681d095
[CI] Auto commit changes from spotless
128f954
remove hard-coded version from azure-core patcher
richard-dennehy e2cb3ca
add missing NOTICE file
richard-dennehy de8a31e
remove unused licenses
richard-dennehy 48e180c
fix license mapping
richard-dennehy e856b86
rewrite azure-core jar unsigner
richard-dennehy a81018e
[CI] Auto commit changes from spotless
09ca5ca
restore missing license
richard-dennehy b44eddb
restore missing notice
richard-dennehy a7d4102
fix license mapping
richard-dennehy 6e2869f
fix license mapping
richard-dennehy bdd9aa1
execute blocking graph calls on generic thread pool
richard-dennehy 0ed032c
[CI] Auto commit changes from spotless
3100eeb
fetch only security group membership
richard-dennehy af348fd
Update docs/changelog/128396.yaml
richard-dennehy 55fb5df
[CI] Auto commit changes from spotless
71782a9
Merge branch 'main' into microsoft-graph-implementation-sdk
richard-dennehy f5ac899
fix security thirdPartyAudit task
richard-dennehy 9b17cb6
fix license mapping
richard-dennehy 1f6b713
ignore IT in FIPS mode
richard-dennehy 2c7cc90
fix build file
richard-dennehy fc93217
fix thirdPartyAudit
richard-dennehy 2fc5fcd
address review comments
richard-dennehy 64a7eb5
[CI] Auto commit changes from spotless
f3865b2
address review comments
richard-dennehy 2ec60f6
[CI] Auto commit changes from spotless
65a751c
set default request timeout of 10 seconds
richard-dennehy 5d9c358
[CI] Auto commit changes from spotless
b8581e2
cancel graph authorization tasks that are pending too long
richard-dennehy 26d2594
[CI] Auto commit changes from spotless
9decc75
fix string interpolator
richard-dennehy 612ad1f
fixup! Register missing settings
jfreden 9af95a3
Merge remote-tracking branch 'upstream/main' into microsoft-graph-imp…
jfreden 35e9ce4
fixup! Test issue
jfreden 02feaa0
Merge branch 'main' into microsoft-graph-implementation-sdk
jfreden 4c2e54d
fixup! Test
jfreden bfd2e09
Merge remote-tracking branch 'upstream/main' into microsoft-graph-imp…
jfreden e5e12ca
Move plugin to new x-pack home
jfreden d753954
Merge remote-tracking branch 'upstream/main' into microsoft-graph-imp…
jfreden 35d2d62
fixup! Code review comment
jfreden 78388f2
fixup! Add build.gradle
jfreden b134b33
fixup! File extension
jfreden b3a9ff9
fixup! File extension
jfreden 6a41e78
fixup! File extension
jfreden bdf0784
fixup! License headers
jfreden 2a9ba66
Merge remote-tracking branch 'upstream/main' into microsoft-graph-imp…
jfreden 8a76115
fixup! Race condition in test
jfreden 6d1821a
Merge branch 'main' into microsoft-graph-implementation-sdk
jfreden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...g/elasticsearch/gradle/internal/dependencies/patches/azurecore/AzureCoreClassPatcher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| package org.elasticsearch.gradle.internal.dependencies.patches.azurecore; | ||
|
|
||
| import org.elasticsearch.gradle.internal.dependencies.patches.PatcherInfo; | ||
| import org.elasticsearch.gradle.internal.dependencies.patches.Utils; | ||
| import org.gradle.api.artifacts.transform.CacheableTransform; | ||
| import org.gradle.api.artifacts.transform.InputArtifact; | ||
| import org.gradle.api.artifacts.transform.TransformAction; | ||
| import org.gradle.api.artifacts.transform.TransformOutputs; | ||
| import org.gradle.api.artifacts.transform.TransformParameters; | ||
| import org.gradle.api.file.FileSystemLocation; | ||
| import org.gradle.api.provider.Provider; | ||
| import org.gradle.api.tasks.Classpath; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| import java.io.File; | ||
| import java.util.List; | ||
| import java.util.regex.Pattern; | ||
|
|
||
| import static org.elasticsearch.gradle.internal.dependencies.patches.PatcherInfo.classPatcher; | ||
|
|
||
| @CacheableTransform | ||
| public abstract class AzureCoreClassPatcher implements TransformAction<TransformParameters.None> { | ||
|
|
||
| private static final String JAR_FILE_TO_PATCH = "azure-core-[\\d.]*\\.jar"; | ||
|
|
||
| private static final List<PatcherInfo> CLASS_PATCHERS = List.of( | ||
| classPatcher( | ||
| "com/azure/core/implementation/ImplUtils.class", | ||
| "7beda5bdff5ea460cfc08721a188cf07d16e0c987dae45401fca7abf4e6e6c0e", | ||
| ImplUtilsPatcher::new | ||
| ) | ||
| ); | ||
|
|
||
| @Classpath | ||
| @InputArtifact | ||
| public abstract Provider<FileSystemLocation> getInputArtifact(); | ||
|
|
||
| @Override | ||
| public void transform(@NotNull TransformOutputs outputs) { | ||
| File inputFile = getInputArtifact().get().getAsFile(); | ||
|
|
||
| if (Pattern.matches(JAR_FILE_TO_PATCH, inputFile.getName())) { | ||
| System.out.println("Patching " + inputFile.getName()); | ||
| File outputFile = outputs.file(inputFile.getName().replace(".jar", "-patched.jar")); | ||
| Utils.patchJar(inputFile, outputFile, CLASS_PATCHERS, true); | ||
| } else { | ||
| System.out.println("Skipping " + inputFile.getName()); | ||
| outputs.file(getInputArtifact()); | ||
| } | ||
| } | ||
|
|
||
| } | ||
34 changes: 34 additions & 0 deletions
34
...va/org/elasticsearch/gradle/internal/dependencies/patches/azurecore/ImplUtilsPatcher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| package org.elasticsearch.gradle.internal.dependencies.patches.azurecore; | ||
|
|
||
| import org.elasticsearch.gradle.internal.dependencies.patches.MethodReplacement; | ||
| import org.objectweb.asm.ClassVisitor; | ||
| import org.objectweb.asm.MethodVisitor; | ||
| import org.objectweb.asm.Opcodes; | ||
|
|
||
| class ImplUtilsPatcher extends ClassVisitor { | ||
| ImplUtilsPatcher(ClassVisitor classVisitor) { | ||
| super(Opcodes.ASM9, classVisitor); | ||
| } | ||
|
|
||
| public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { | ||
| MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions); | ||
| // `addShutdownHook` invokes `java.lang.Runtime.addShutdownHook`, which is forbidden (i.e. it will throw an Entitlements error). | ||
| // We replace the method body here with `return null`. | ||
| if (name.equals("addShutdownHookSafely")) { | ||
| return new MethodReplacement(mv, () -> { | ||
| mv.visitInsn(Opcodes.ACONST_NULL); | ||
| mv.visitInsn(Opcodes.ARETURN); | ||
| }); | ||
| } | ||
| return mv; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,6 +117,7 @@ dependencies { | |
| log4jConfig project(path: ":distribution", configuration: 'log4jConfig') | ||
| tini "krallin:tini:0.19.0:${tiniArch}" | ||
| allPlugins project(path: ':plugins', configuration: 'allPlugins') | ||
| allPlugins project(path: ':x-pack:extras:plugins', configuration: 'allPlugins') | ||
| filebeat_aarch64 "beats:filebeat:${VersionProperties.elasticsearch}:[email protected]" | ||
| filebeat_x86_64 "beats:filebeat:${VersionProperties.elasticsearch}:[email protected]" | ||
| filebeat_fips_aarch64 "beats:filebeat-fips:${VersionProperties.elasticsearch}:[email protected]" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 128396 | ||
| summary: Delegated authorization using Microsoft Graph (SDK) | ||
| area: Authorization | ||
| type: feature | ||
| issues: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
plugins/microsoft-graph-authz/src/main/java/module-info.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.