Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

adal4j with java 6 #301

Closed
GiamBoscaro opened this issue Jan 5, 2021 · 7 comments
Closed

adal4j with java 6 #301

GiamBoscaro opened this issue Jan 5, 2021 · 7 comments

Comments

@GiamBoscaro
Copy link

Good evening,

I need to use adal4j on an old java 6 project. I am wondering where can I find an older version of adal4j that works with java 1.6, or what can I do to make it work. Any help?

Thank you

@sangonzal
Copy link
Contributor

@GiamBoscaro The library uses Java 7 features throughout the codebase, so it will not work with Java 6. If really needed (not recommending this) you could fork the code and try to removing them. I haven't looked into this, so not sure how much work it would be. Would it be possible to update the project you are working on to use Java 7?

Also note that ADAL is deprecated and will not receive updates moving forward. Instead we recommend customers use MSAL. MSAL requires Java 8 or higher.

@GiamBoscaro
Copy link
Author

I know it is deprecated, but the project I am working on it's really old and I just need to make it work for a year more or so. Porting to java 7 it is becoming a real pain so I'd just like to find a way to make adal4j work on java 1.6 or maybe find an alternative library.

@sangonzal
Copy link
Contributor

@GiamBoscaro What scenarios are you trying to support in your application?

@GiamBoscaro
Copy link
Author

@GiamBoscaro What scenarios are you trying to support in your application?

I need to do a few calls to a new api that is authenticated via azure. I'll be as lazy as possible so I'll probably just need to get the token every api call, set the header and send the request

@sangonzal
Copy link
Contributor

@GiamBoscaro Is your application a desktop app/ command line app or a web app/ web API? Do you need to get tokens for an user or for your application? The different ways that ADAL acquires tokens are explained here.

@GiamBoscaro
Copy link
Author

@GiamBoscaro Is your application a desktop app/ command line app or a web app/ web API? Do you need to get tokens for an user or for your application? The different ways that ADAL acquires tokens are explained here.

It's a web application. I only have an application ID and secret, so I need to authenticate the application but not the user. I should refresh this token every 30 mins-1hr, but I'll just be lazy and just send a new auth request before every api call.

I have already read the guide on how to acquire tokens and indeed it works (from what I remember I was using the method acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, ClientCredential credential, AuthenticationCallback callback). But obviously it works only in a Java 7 environment. I get unsupported major.minor version 51.0 when I try to run even the simplest code in Java 6.

@sangonzal
Copy link
Contributor

@GiamBoscaro The most straightforward way would probably be to create the Http request yourself. You would use client credentials grant. This doc shows the required parameters. You could also use an Java Oauth2 library that supports Java 6 if that makes it easier for you.

Closing this issue as it's no longer related to ADAL.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants