majguo / liberty-aad-oidc Goto Github PK
View Code? Open in Web Editor NEWSecuring Open Liberty/WebSphere Liberty Application with Azure Active Directory via OpenID Connect
License: MIT License
Securing Open Liberty/WebSphere Liberty Application with Azure Active Directory via OpenID Connect
License: MIT License
Please add this link (https://openliberty.io/) to the first mentioning of Open Liberty.
Add links to MicroProfile (microprofile.io) and Jakarta EE (https://jakarta.ee/)
JAX-rs link should be https://github.com/eclipse-ee4j/jaxrs-api/
Please use the following best practices for authoring Dockerfile.
The key is to run configure.sh.
You can find Open Liberty's docker images from here.
WebSphere Liberty docker image
Please demonstrate both Java8 and Java11 versions.
Just some minor comments:
I see you tried to work out the uri via InetAddress. I am wondering how it will function in Kubernetes. MicroProfile Rest Client offers a good service binding approach, which allows you to override the backend url under a different environment. Can you take a look at this guide to see whether you can use MicroProfile Rest Client. You can define an interface with getAllCoffees() and then annotated with @RegisterRestClient
. In your Coffee.java, you can inject that via @Inject @RestClient AInterface
.
@PostConstruct
private void init() {
try {
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext()
.getRequest();
InetAddress inetAddress = InetAddress.getByName(request.getServerName());
baseUri = FacesContext.getCurrentInstance().getExternalContext().getRequestScheme() + "://"
+ inetAddress.getHostName() + ":"
+ FacesContext.getCurrentInstance().getExternalContext().getRequestServerPort()
+ "/javaee-cafe/rest/coffees";
this.client = ClientBuilder.newBuilder().hostnameVerifier(new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) {
return true;
}
}).build();
this.getAllCoffees();
} catch (IllegalArgumentException | NullPointerException | WebApplicationException | UnknownHostException ex) {
logger.severe("Processing of HTTP response failed.");
ex.printStackTrace();
}
}
In your CafeRepositor.java, you define it as a Stateless bean. I recommend you not to use EJB but to CDI as EJB is very bulky and the future is CDI.
You can simply replace Stateless with @Dependent
I checked out your gitrepo and tried to build with Java 11. However it failed because jaxb was deleted from JDK11. I added the following
javax.xml.bind
jaxb-api
2.3.1
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.2</version>
</dependency>
I changed the pom.xml to add liberty maven plugin so that you can start your app when running mvn clean package
[20.0.0.1,) 3.2 </plugin>
You can even do mvn liberty:dev
to start you app in dev mode so that you can watch the changes as you code along.
I also moved server.xml from the root to src/main and then under liberty/config so that the server.xml can be picked up automatically. I think it is neater that. You can config the location to server.xml if you like. See here for more info.
By the way, I have not set up all the necessary credentials, so I did not do the full test. Please try the suggestions out to see whether you hit any issues.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.