Skip to content

Commit

Permalink
refactor: move uma-rs
Browse files Browse the repository at this point in the history
Co-authored-by: Arnab Dutta <[email protected]>
Co-authored-by: Yuriy Movchan <[email protected]>
Co-authored-by: Yuriy Zabrovarnyy <[email protected]>
Co-authored-by: YuriyZ <[email protected]>
Co-authored-by: yurem <[email protected]>

Signed-off-by: moabu <[email protected]>
  • Loading branch information
yurem authored and moabu committed Oct 14, 2024
1 parent ed30327 commit 6e0e9e4
Show file tree
Hide file tree
Showing 35 changed files with 2,175 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
/scim/ @jgomer2001
/oxTrust/ @yurem @shekhar16
/oxShibboleth/ @yurem @uprightech
/oxd/ @duttarnab @yuriyz
/oxd/ @duttarnab @yuriyz
/uma-rs/ @yurem @yuriyz
14 changes: 14 additions & 0 deletions uma-rs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Eclipse project files
.settings
.project
.classpath
.pydevproject
.tern-project
.faces-config.xml.jsfdia

# IntelliJ IDEA project files
.idea
*.iml

# Maven
target
99 changes: 99 additions & 0 deletions uma-rs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
IMPORTANT - READ CAREFULLY: This License Agreement is a legal agreement between You and Gluu, Inc. Read it carefully before
completing the installation process and using the Software. It provides a license to use the Software and contains warranty
information and liability disclaimers. BY INSTALLING, COPYING OR OTHERWISE USING THE SOFTWARE, YOU ARE CONFIRMING YOUR
ACCEPTANCE OF THE SOFTWARE AND AGREEING TO BECOME BOUND BY THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT INSTALL
OR USE THE PRODUCT. The Software is owned by Gluu, Inc. and/or its licensors and is protected by copyright laws and
international copyright treaties, as well as other intellectual property laws and treaties.

1. DEFINITIONS.
a. "Vendor" means Gluu, Inc.
b. "You", "Your" means you and your company.
c. "Software" means the product provided to You, which includes computer software and may include associated media, printed
materials, and "online" or electronic documentation.

2. OWNERSHIP. The Software is owned and copyrighted by Vendor and/or its licensors. Your license confers no title or
ownership in the Software and is not a sale of any rights in the Software.

3. GRANT OF LICENSE. Vendor grants You the following rights provided You comply with all terms and conditions of this
agreement. For each license You have acquired for the Software:
a. You are granted a non-exclusive right to use and install the Software.
b. You may modify the configuration files (if applicable).

4. RESTRICTED USE.
a. You agree to use reasonable efforts to prevent unauthorized copying of the Software.
b. You may not disable any licensing or control features of the Software or allow the Software to be used with such features
disabled.
c. You may not share, rent, or lease Your right to use the Software.
d. You may not modify, sublicense, copy, rent, sell, distribute or transfer any part of the Software except as provided in
this Agreement.
e. You may not reverse engineer, decompile, translate, create derivative works, decipher, decrypt, disassemble, or otherwise
convert the Software to a more human-readable form for any reason.
f. You will return or destroy all copies of the Software if and when Your right to use it ends.
g. You may not use the Software for any purpose that is unlawful.
h. You many not use data (or graphs) generated by this Software in unlawful activities.
i. You may not use the Software or data (or graphs) to assist in the generation of unsolicited email (spam). This includes
the collection of email addresses or personal details.

5. ADDITIONAL SOFTWARE This license applies to updates, upgrades, plug-ins and any other additions to the original Software
provided by Vendor, unless Vendor provides other terms along with the additional software.

6. 3RD PARTY SERVICES This Software may make use of, or have the ability to make use of, link to, or integrate with the Gluu
Server which in turn could use 3rd party content or services. The availability of the content or services is at the sole
discretion of the 3rd party service providers and may be subject to usage agreements and other restrictions. You will ensure
that you abide by the agreements and restrictions of these 3rd party content or service providers. You furthermore agree to
indemnify and save Vendor and its licensors from all claims, damages, and expenses of whatever nature that may be made
against Vendor and its licensors by 3rd party content and service providers as a result of Your use of the Software.

7. REGISTRATION. The software will electronically register itself during installation to confirm that You have entered a
valid "License Key". The registration process only sends the license information that You've entered (License key) and
information about the software installed (Program ID, Version, Checksum and selected Network Interface MAC address). No other
information is sent.

8. UPGRADES. If this copy of the software is an upgrade from an earlier version of the software, it is provided to You on a
license exchange basis. Your use of the Software upgrade is subject to the terms of this license, and You agree by Your
installation and use of this copy of the Software to voluntarily terminate Your earlier license and that You will not
continue to use the earlier version of the Software or transfer it to another person or entity.

9. TRANSFER. You cannot transfer the Software and Your rights under this license to another party.

10. SUBLICENSING. You may not sublicense the Software and Your rights under this license to another party

11. TERMINATION. Vendor may terminate Your license if You do not abide by the license terms or if You have not paid applicable
license fees. Termination of the license may include, but not be limited to, marking the License Key as invalid to prevent
further installations or usage. Upon termination of license, You shall immediately discontinue the use of the Software
and shall within ten (10) days return to Vendor all copies of the Software or confirm that You have destroyed all copies of it.
Your obligations to pay accrued charges and fees, if any, shall survive any termination of this Agreement. Vendor's third party
licensors may protect their rights in the event of any violation of the terms and conditions of this license. You agree to
indemnify Vendor and its licensors for reasonable attorney fees in enforcing its rights pursuant to this license.

12. DISCLAIMER OF WARRANTY. The Software is provided on an "AS IS" basis, without warranty of any kind, including, without
limitation, the warranties of merchantability, fitness for a particular purpose and non- infringement. The entire risk as to
the quality and performance of the Software is borne by You. Should the Software prove defective, You, not Vendor or its
licensors, assume the entire cost of any service and repair. If the Software is intended to link to, extract content from or
otherwise integrate with a third party service, Vendor makes no representation or warranty that Your particular use of the
Software is or will continue to be authorized by law in Your jurisdiction or that the third party service will continue to be
available to You. This disclaimer of warranty constitutes an essential part of the agreement.

13. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT, OR OTHERWISE, SHALL VENDOR OR
ITS LICENSORS BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR WORK STOPPAGE, COMPUTER FAILURE OR LOSS OF REVENUES, PROFITS,
GOODWILL, USE, DATA OR OTHER INTANGIBLE OR ECONOMIC LOSSES. IN NO EVENT WILL VENDOR OR ITS LICENSORS BE LIABLE FOR ANY
DAMAGES IN EXCESS OF THE AMOUNT PAID TO LICENSE THE SOFTWARE, EVEN IF YOU OR ANY OTHER PARTY SHALL HAVE INFORMED VENDOR OR ITS
LICENSORS OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM. NO CLAIM, REGARDLESS OF FORM, MAY BE MADE OR ACTION BROUGHT BY
YOU MORE THAN ONE YEAR AFTER THE BASIS FOR THE CLAIM BECOMES KNOWN TO THE PARTY ASSERTING IT.

14. APPLICABLE LAW. This license shall be interpreted in accordance with the laws of the State of Texas. Any disputes arising
out of this license shall be adjudicated in a court of competent jurisdiction in the State of Texas.

15. GOVERNING LANGUAGE. Any translation of this License is done for local requirements and in the event of a dispute between
the English and any non-English versions, the English version of this License shall govern.

16. ENTIRE AGREEMENT. This license constitutes the entire agreement between the parties relating to the Software and supersedes
any proposal or prior agreement, oral or written, and any other communication relating to the subject matter of this license.
Any conflict between the terms of this License Agreement and any Purchase Order, invoice, or representation shall be resolved
in favor of the terms of this License Agreement. In the event that any clause or portion of any such clause is declared invalid
for any reason, such finding shall not affect the enforceability of the remaining portions of this License and the
unenforceable clause shall be severed from this license. Any amendment to this agreement must be in writing and signed by
both parties.


61 changes: 61 additions & 0 deletions uma-rs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# uma-rs
UMA Resource Server library - helps to easily protect Java based project with UMA in declarative way.


### Sample declaration

```json
{"resources":[
{
"path":"/photo",
"conditions":[
{
"httpMethods":["GET"],
"scopes":[
"http://photoz.example.com/dev/actions/view"
]
},
{
"httpMethods":["PUT", "POST"],
"scopes":[
"http://photoz.example.com/dev/actions/all",
"http://photoz.example.com/dev/actions/add"
],
"ticketScopes":[
"http://photoz.example.com/dev/actions/add"
]
}
]
},
{
"path":"/document",
"conditions":[
{
"httpMethods":["GET"],
"scopes":[
"http://photoz.example.com/dev/actions/view"
]
}
]
}
]
}
```

`ticketScopes` are used for UMA ticket registration. If it is skipped then ALL scopes are registered for ticket.

### Usage

```java
Configuration configuration = ConfigurationLoader.loadFromJson(inputStream(CONFIGURATION_FILE_NAME));
Collection<RsResource> values = RsProtector.instance(inputStream(PROTECTION_CONFIGURATION_FILE_NAME)).getResourceMap().values();

ServiceProvider serviceProvider = new ServiceProvider(configuration);
PatProvider patProvider = new PatProvider(serviceProvider);
ResourceRegistrar resourceRegistrar = new ResourceRegistrar(patProvider);

resourceRegistrar.register(values);
```

Check [RS demo](https://github.com/GluuFederation/oxUmaDemo/tree/master/RS) project sources.

4 changes: 4 additions & 0 deletions uma-rs/mvn-ox.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set M2_HOME=U:\own\java\apache-maven-3.0.3
set MAVEN_OPTS=-Xms128M -Xmx512M -XX:MaxPermSize=192M

%M2_HOME%\bin\mvn.bat -s settings.xml %*
173 changes: 173 additions & 0 deletions uma-rs/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>org.gluu</groupId>
<artifactId>uma-rs</artifactId>
<packaging>pom</packaging>
<version>4.5.6-SNAPSHOT</version>
<name>UMA RS</name>
<url>https://www.gluu.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.min-version>3.0.3</maven.min-version>
<slf4j.version>1.7.11</slf4j.version>
<oxauth.version>4.5.6-SNAPSHOT</oxauth.version>
</properties>

<prerequisites>
<maven>${maven.min-version}</maven>
</prerequisites>

<modules>
<module>uma-rs-core</module>
<module>uma-rs-resteasy</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<failIfNoTests>false</failIfNoTests>
<trimStackTrace>false</trimStackTrace>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gluu</groupId>
<artifactId>gluu-core-bom</artifactId>
<version>4.5.6-SNAPSHOT</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.gluu</groupId>
<artifactId>oxauth-model</artifactId>
<version>${oxauth.version}</version>
</dependency>
<dependency>
<groupId>org.gluu</groupId>
<artifactId>oxauth-client</artifactId>
<version>${oxauth.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>17.0</version>
</dependency>
</dependencies>
</dependencyManagement>

<repositories>
<repository>
<id>gluu</id>
<name>Gluu repository</name>
<url>https://maven.gluu.org/maven</url>
</repository>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>repository.jboss.org</id>
<name>JBoss Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
<repository>
<id>bouncycastle</id>
<name>Bouncy Castle</name>
<url>https://repo2.maven.org/maven2/org/bouncycastle</url>
</repository>
<repository>
<id>local</id>
<name>oxd local repository</name>
<url>file://${project.basedir}/../oxd-repo</url>
</repository>
</repositories>

</project>
13 changes: 13 additions & 0 deletions uma-rs/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<settings>
<localRepository>U:/own/mvn_repository/</localRepository>
<offline>false</offline>


<!--mirrors>
<mirror>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors-->
</settings>
Loading

0 comments on commit 6e0e9e4

Please sign in to comment.