-
Notifications
You must be signed in to change notification settings - Fork 30
Rsh/azure identity auth #42
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
Conversation
@ramsessanchez Can you add some example code to your description that shows how you use a credential object with the SDK client? |
src/main/java/com/microsoft/graph/authentication/IAuthenticationProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/graph/authentication/TokenCredentialAuthProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/graph/authentication/TokenCredentialAuthProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/graph/authentication/TokenCredentialAuthProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/graph/authentication/TokenCredentialAuthProvider.java
Show resolved
Hide resolved
…alAuthProvider.java Co-authored-by: DeVere Dyett <ddyett@microsoft.com>
…alAuthProvider.java Co-authored-by: DeVere Dyett <ddyett@microsoft.com>
…raph/msgraph-sdk-java-core into rsh/AzureIdentityAuth
src/main/java/com/microsoft/graph/authentication/TokenCredentialAuthProvider.java
Outdated
Show resolved
Hide resolved
Sorry for not realizing this in the first review. GitHub is not great in highlighting a binary in review. Do we have to add gradle-wrapper.jar into source control? I have read this answer in SO: https://stackoverflow.com/a/20351077, but I am still not convinced. I am hoping this experience has improved since the time the answer was posted to SO. And if we have to check-in, do we really need two copies of the same binary checked in? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would be nice to have if we can work around not checking in the .jar files.
samples/interactiveBrowserSample/src/main/java/interactiveBrowserMain.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/graph/authentication/BaseAuthenticationProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/graph/authentication/BaseAuthenticationProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/graph/authentication/TokenCredentialAuthProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/graph/authentication/TokenCredentialAuthProvider.java
Show resolved
Hide resolved
src/main/java/com/microsoft/graph/authentication/TokenCredentialAuthProvider.java
Show resolved
Hide resolved
src/test/java/com/microsoft/graph/authentication/TokenCredentialAuthProviderTest.java
Outdated
Show resolved
Hide resolved
public void providerAddsTokenOnValidHostName() throws MalformedURLException, InterruptedException, | ||
ExecutionException { | ||
// Arrange | ||
final URL url = new URL("https://graph.microsoft.com"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about a test for all of the national and public cloud endpoints (such as in the test above)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it add any value though? the code it depends on is already tested for the multiple national clouds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, we don't need this test at all, right? Because that other test also covers https://graph.microsoft.com (unless I misunderstood)?
@zengin as far as I can tell it's standard practice to commit the wrapper jar to the repo. The script bootstraps the wrapper which in turns downloads gradle. If you remove it you need to make sure gradle is installed on the local machine, and use the globally installed version instead of the scripts. |
src/main/java/com/microsoft/graph/authentication/IAuthenticationProvider.java
Show resolved
Hide resolved
…ests - enables and fixes last disabled tests for CoreHttpProvider
@zengin we could update the paths in
|
feature/batches execution
Added TokenCredentialAuthProvider which uses Azure identity, it takes in a parameter of type TokenCredential to instantiate the class and can be used to authenticate a request by retrieving the access token. Included test classes to test this class, which required a dependency on Mockito to properly test this class.
Example:
Copied over some files from the Service library in relation to Authentication, namely the IAuthenticationProvider interface, the AuthConstants class, IHttpRequest interface, the HttpMethod enum class, and the options folder which contains the HeaderOption and Option class. All classes that were copied from the service library were placed into a folder with the same namespace as in the service library to prevent breaking changes.
Added a couple new dependencies to the the build.gradle file:
-Azure-Identity
-Mockito
-Java 8, the current LTS
Let me know if any of the javadocs included need to be clarified or simplified.