Skip to content

Commit

Permalink
Shiro native support #1844
Browse files Browse the repository at this point in the history
  • Loading branch information
JiriOndrusek authored and github-actions[bot] committed Oct 8, 2020
1 parent a417bf3 commit 2628b89
Show file tree
Hide file tree
Showing 22 changed files with 550 additions and 122 deletions.
8 changes: 4 additions & 4 deletions docs/modules/ROOT/pages/reference/extensions/shiro.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
= Shiro
:cq-artifact-id: camel-quarkus-shiro
:cq-native-supported: false
:cq-status: Preview
:cq-native-supported: true
:cq-status: Stable
:cq-description: Security using Shiro
:cq-deprecated: false
:cq-jvm-since: 1.2.0
:cq-native-since: n/a
:cq-native-since: 1.2.0

[.badges]
[.badge-key]##JVM since##[.badge-supported]##1.2.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
[.badge-key]##JVM since##[.badge-supported]##1.2.0## [.badge-key]##Native since##[.badge-supported]##1.2.0##

Security using Shiro

Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/partials/reference/others/shiro.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
:cq-artifact-id: camel-quarkus-shiro
:cq-artifact-id-base: shiro
:cq-native-supported: false
:cq-status: Preview
:cq-native-supported: true
:cq-status: Stable
:cq-deprecated: false
:cq-jvm-since: 1.2.0
:cq-native-since: n/a
:cq-native-since: 1.2.0
:cq-camel-part-name: shiro
:cq-camel-part-title: Shiro
:cq-camel-part-description: Security using Shiro
Expand Down
1 change: 0 additions & 1 deletion extensions-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
<module>saga</module>
<module>saxon</module>
<module>schematron</module>
<module>shiro</module>
<module>sip</module>
<module>smpp</module>
<module>snmp</module>
Expand Down

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
<module>seda</module>
<module>servicenow</module>
<module>servlet</module>
<module>shiro</module>
<module>sjms</module>
<module>sjms2</module>
<module>slack</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-commons-logging-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-shiro</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* 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.camel.quarkus.component.shiro.deployment;

import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.List;
import java.util.stream.Collectors;

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.EnableAllSecurityServicesBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import org.apache.camel.CamelAuthorizationException;
import org.apache.shiro.ShiroException;
import org.jboss.jandex.DotName;

class ShiroProcessor {

private static final String FEATURE = "camel-shiro";

private static final DotName SHIRO_EXCEPTION_NAME = DotName.createSimple(ShiroException.class.getName());

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep
EnableAllSecurityServicesBuildItem enableAllSecurity() {
return new EnableAllSecurityServicesBuildItem();
}

@BuildStep
ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem combinedIndex) {
List<String> dtos = combinedIndex.getIndex()
.getAllKnownSubclasses(SHIRO_EXCEPTION_NAME)
.stream()
.map(c -> c.name().toString())
.filter(n -> n.startsWith("org.apache.shiro.auth"))
.collect(Collectors.toList());

dtos.add(CamelAuthorizationException.class.getName());
dtos.add(Float[].class.getName());
dtos.add(java.util.Date[].class.getName());
dtos.add(Calendar[].class.getName());
dtos.add(java.sql.Date[].class.getName());
dtos.add(Time[].class.getName());
dtos.add(Timestamp[].class.getName());

return new ReflectiveClassBuildItem(false, false, dtos.toArray(new String[dtos.size()]));
}

@BuildStep
IndexDependencyBuildItem registerDependencyForIndex() {
return new IndexDependencyBuildItem("org.apache.shiro", "shiro-core");
}
}
1 change: 0 additions & 1 deletion extensions-jvm/shiro/pom.xml → extensions/shiro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@
<modules>
<module>deployment</module>
<module>runtime</module>
<module>integration-test</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<properties>
<camel.quarkus.jvmSince>1.2.0</camel.quarkus.jvmSince>
<camel.quarkus.nativeSince>1.2.0</camel.quarkus.nativeSince>
</properties>

<dependencyManagement>
Expand All @@ -57,6 +58,25 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-shiro</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-commons-logging</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>svm</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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.camel.quarkus.component.shiro;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import org.apache.shiro.config.DefaultInterpolator;
import org.apache.shiro.config.Interpolator;
import org.apache.shiro.config.ReflectionBuilder;

@TargetClass(value = ReflectionBuilder.class)
final class ReflectionBuilderSubstitute {

@Substitute
private Interpolator createInterpolator() {
return new DefaultInterpolator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
name: "Camel Shiro"
description: "Security using Shiro"
metadata:
unlisted: true
guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/shiro.html"
categories:
- "integration"
status:
- "preview"
- "stable"
1 change: 1 addition & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<module>send-dynamic-http</module>
<module>servicenow</module>
<module>servlet</module>
<module>shiro</module>
<module>slack</module>
<module>smallrye-reactive-messaging</module>
<module>soap</module>
Expand Down

0 comments on commit 2628b89

Please sign in to comment.