Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions artemis-features/src/main/resources/features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<bundle dependency="true">mvn:org.apache.commons/commons-pool2/${commons.pool2.version}</bundle>
<!-- Micrometer can't be included until it supports OSGi. It is currently an "optional" Maven dependency. -->
<!--bundle dependency="true">mvn:io.micrometer/micrometer-core/${version.micrometer}</bundle-->
<bundle dependency="true">mvn:com.nimbusds/nimbus-jose-jwt/${nimbus.jwt.version}</bundle>

<bundle>mvn:org.apache.activemq/activemq-artemis-native/${activemq-artemis-native-version}</bundle>
<bundle>mvn:org.apache.artemis/artemis-lockmanager-api/${pom.version}</bundle>
Expand Down
8 changes: 8 additions & 0 deletions artemis-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,14 @@
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>${nimbus.jwt.version}</version>
<!-- License: Apache 2.0 -->
</dependency>

</dependencies>
</dependencyManagement>

Expand Down
2 changes: 2 additions & 0 deletions artemis-server-osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@
io.netty.buffer;io.netty.*;version="[4.1,5)",
java.net.http*;resolution:=optional,
com.sun.net.httpserver*;resolution:=optional,
com.nimbusds.jose*;resolution:=optional,
com.nimbusds.jwt*;resolution:=optional,
*
</Import-Package>
<_exportcontents>org.apache.activemq.artemis.*;-noimport:=true</_exportcontents>
Expand Down
4 changes: 4 additions & 0 deletions artemis-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-artemis-native</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallback
nameCallback.setName(username);
} else if (callback instanceof CertificateCallback certificateCallback) {
certificateCallback.setCertificates(getCertsFromConnection(remotingConnection));
} else if (callback instanceof JwtCallback jwtCallback) {
// TODO: switch to obtaining the token from RemotingConnection and protocol-specific implementation (SASL frames)
jwtCallback.setJwtToken(password);
} else if (callback instanceof PrincipalsCallback principalsCallback) {

Subject peerSubject = remotingConnection.getSubject();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.spi.core.security.jaas;

import javax.security.auth.callback.Callback;

/**
* A {@link Callback} for passing JWT token to {@link javax.security.auth.spi.LoginModule login modules}. JWT
* tokens may come from {@code Bearer} HTTP header or SASL messages.
*/
public class JwtCallback implements Callback {

private String jwtToken;

public String getJwtToken() {
return jwtToken;
}

public void setJwtToken(String jwtToken) {
this.jwtToken = jwtToken;
}

}
Loading