-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GUACAMOLE-1020: Implement extension with enhanced login and connectio…
…n restrictions.
- Loading branch information
1 parent
a987612
commit d76cd50
Showing
48 changed files
with
3,033 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This product includes software developed by | ||
The Apache Software Foundation (http://www.apache.org/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Apache Commons BeanUtils | ||
(http://commons.apache.org/proper/commons-beanutils/) | ||
----------------------------------------------------- | ||
|
||
Version: 1.9.4 | ||
From: 'Apache Software Foundation' (https://www.apache.org/) | ||
License(s): | ||
Apache v2.0 | ||
|
2 changes: 2 additions & 0 deletions
2
doc/licenses/apache-commons-beanutils-1.9.4/dep-coordinates.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
commons-beanutils:commons-beanutils-core:jar:1.9.4 | ||
commons-beanutils:commons-beanutils:jar:1.9.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Apache Jakarta Commons Digester | ||
Copyright 2001-2006 The Apache Software Foundation | ||
|
||
This product includes software developed by | ||
The Apache Software Foundation (http://www.apache.org/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Apache Commons Digester | ||
(http://commons.apache.org/proper/commons-digester/) | ||
---------------------------------------------------- | ||
|
||
Version: 2.1 | ||
From: 'Apache Software Foundation' (https://www.apache.org/) | ||
License(s): | ||
Apache v2.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
commons-digester:commons-digester:jar:2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Apache Commons Net | ||
Copyright 2001-2023 The Apache Software Foundation | ||
|
||
This product includes software developed at | ||
The Apache Software Foundation (https://www.apache.org/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Apache Commons Net (http://commons.apache.org/proper/commons-net/) | ||
-------------------------------------------------------------------- | ||
|
||
Version: 3.9.0 | ||
From: 'Apache Software Foundation' (https://www.apache.org/) | ||
License(s): | ||
Apache v2.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
commons-net:commons-net:jar:3.9.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This product includes software developed by | ||
The Apache Software Foundation (http://www.apache.org/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Apache Commons Validator | ||
(https://commons.apache.org/proper/commons-validator/) | ||
----------------------------------------------------- | ||
|
||
Version: 1.7 | ||
From: 'Apache Software Foundation' (https://www.apache.org/) | ||
License(s): | ||
Apache v2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
commons-validator:commons-validator:jar:1.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ipaddress (https://github.com/seancfoley/IPAddress) | ||
--------------------------------------------- | ||
|
||
Version: 5.4.0 | ||
From: 'Sean C Foley' (https://github.com/seancfoley) | ||
License(s): | ||
Apache v2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.github.seancfoley:ipaddress:jar:5.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
src/main/resources/generated/ | ||
target/ | ||
*~ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<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/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.apache.guacamole</groupId> | ||
<artifactId>guacamole-auth-restrict</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.5.1</version> | ||
<name>guacamole-auth-restrict</name> | ||
<url>http://guacamole.apache.org/</url> | ||
|
||
<parent> | ||
<groupId>org.apache.guacamole</groupId> | ||
<artifactId>extensions</artifactId> | ||
<version>1.5.1</version> | ||
<relativePath>../</relativePath> | ||
</parent> | ||
|
||
<build> | ||
<plugins> | ||
|
||
<!-- Pre-cache Angular templates with maven-angular-plugin --> | ||
<plugin> | ||
<groupId>com.keithbranton.mojo</groupId> | ||
<artifactId>angular-maven-plugin</artifactId> | ||
<version>0.3.4</version> | ||
<executions> | ||
<execution> | ||
<phase>generate-resources</phase> | ||
<goals> | ||
<goal>html2js</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<sourceDir>${basedir}/src/main/resources</sourceDir> | ||
<include>**/*.html</include> | ||
<target>${basedir}/src/main/resources/generated/templates-main/templates.js</target> | ||
<prefix>app/ext/restrict</prefix> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- JS/CSS Minification Plugin --> | ||
<plugin> | ||
<groupId>com.github.buckelieg</groupId> | ||
<artifactId>minify-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>default-cli</id> | ||
<configuration> | ||
<charset>UTF-8</charset> | ||
|
||
<webappSourceDir>${basedir}/src/main/resources</webappSourceDir> | ||
<webappTargetDir>${project.build.directory}/classes</webappTargetDir> | ||
|
||
<cssSourceDir>/</cssSourceDir> | ||
<cssTargetDir>/</cssTargetDir> | ||
<cssFinalFile>restrict.css</cssFinalFile> | ||
|
||
<cssSourceFiles> | ||
<cssSourceFile>license.txt</cssSourceFile> | ||
</cssSourceFiles> | ||
|
||
<cssSourceIncludes> | ||
<cssSourceInclude>**/*.css</cssSourceInclude> | ||
</cssSourceIncludes> | ||
|
||
<jsSourceDir>/</jsSourceDir> | ||
<jsTargetDir>/</jsTargetDir> | ||
<jsFinalFile>restrict.js</jsFinalFile> | ||
|
||
<jsSourceFiles> | ||
<jsSourceFile>license.txt</jsSourceFile> | ||
</jsSourceFiles> | ||
|
||
<jsSourceIncludes> | ||
<jsSourceInclude>**/*.js</jsSourceInclude> | ||
</jsSourceIncludes> | ||
|
||
<!-- Do not minify and include tests --> | ||
<jsSourceExcludes> | ||
<jsSourceExclude>**/*.test.js</jsSourceExclude> | ||
</jsSourceExcludes> | ||
<jsEngine>CLOSURE</jsEngine> | ||
|
||
<!-- Disable warnings for JSDoc annotations --> | ||
<closureWarningLevels> | ||
<misplacedTypeAnnotation>OFF</misplacedTypeAnnotation> | ||
<nonStandardJsDocs>OFF</nonStandardJsDocs> | ||
</closureWarningLevels> | ||
|
||
</configuration> | ||
<goals> | ||
<goal>minify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
|
||
<!-- Guacamole Extension API --> | ||
<dependency> | ||
<groupId>org.apache.guacamole</groupId> | ||
<artifactId>guacamole-ext</artifactId> | ||
<version>1.5.1</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Guava - Utility Library --> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</dependency> | ||
|
||
<!-- Guice --> | ||
<dependency> | ||
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
</dependency> | ||
|
||
<!-- Java servlet API --> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>servlet-api</artifactId> | ||
<version>2.5</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- JUnit --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Guacamole depends on an implementation of JAX-WS --> | ||
<dependency> | ||
<groupId>javax.ws.rs</groupId> | ||
<artifactId>javax.ws.rs-api</artifactId> | ||
<version>2.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Apache Commons Utilities for IP Addresses and Subnets --> | ||
<dependency> | ||
<groupId>commons-validator</groupId> | ||
<artifactId>commons-validator</artifactId> | ||
<version>1.7</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>commons-net</groupId> | ||
<artifactId>commons-net</artifactId> | ||
<version>3.9.0</version> | ||
</dependency> | ||
|
||
<!-- Library for unified IPv4/6 parsing and validation --> | ||
<dependency> | ||
<groupId>com.github.seancfoley</groupId> | ||
<artifactId>ipaddress</artifactId> | ||
<version>5.4.0</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
53 changes: 53 additions & 0 deletions
53
extensions/guacamole-auth-restrict/src/main/assembly/dist.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<assembly | ||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> | ||
|
||
<id>dist</id> | ||
<baseDirectory>${project.artifactId}-${project.version}</baseDirectory> | ||
|
||
<!-- Output tar.gz --> | ||
<formats> | ||
<format>tar.gz</format> | ||
</formats> | ||
|
||
<!-- Include licenses and extension .jar --> | ||
<fileSets> | ||
|
||
<!-- Include licenses --> | ||
<fileSet> | ||
<outputDirectory></outputDirectory> | ||
<directory>target/licenses</directory> | ||
</fileSet> | ||
|
||
<!-- Include extension .jar --> | ||
<fileSet> | ||
<directory>target</directory> | ||
<outputDirectory></outputDirectory> | ||
<includes> | ||
<include>*.jar</include> | ||
</includes> | ||
</fileSet> | ||
|
||
</fileSets> | ||
|
||
</assembly> |
62 changes: 62 additions & 0 deletions
62
...t/src/main/java/org/apache/guacamole/auth/restrict/RestrictionAuthenticationProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* 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.guacamole.auth.restrict; | ||
|
||
import org.apache.guacamole.GuacamoleException; | ||
import org.apache.guacamole.auth.restrict.user.RestrictUserContext; | ||
import org.apache.guacamole.net.auth.AbstractAuthenticationProvider; | ||
import org.apache.guacamole.net.auth.AuthenticatedUser; | ||
import org.apache.guacamole.net.auth.Credentials; | ||
import org.apache.guacamole.net.auth.UserContext; | ||
|
||
/** | ||
* AuthenticationProvider implementation which provides additional restrictions | ||
* for users, groups of users, connections, and connection groups, allowing | ||
* administrators to further control access to Guacamole resources. | ||
*/ | ||
public class RestrictionAuthenticationProvider extends AbstractAuthenticationProvider { | ||
|
||
@Override | ||
public String getIdentifier() { | ||
return "restrict"; | ||
} | ||
|
||
@Override | ||
public UserContext decorate(UserContext context, | ||
AuthenticatedUser authenticatedUser, Credentials credentials) | ||
throws GuacamoleException { | ||
|
||
// Verify identity of user | ||
RestrictionVerificationService.verifyLoginRestrictions(context, authenticatedUser); | ||
|
||
// User has been verified, and authentication should be allowed to | ||
// continue | ||
return new RestrictUserContext(context, credentials.getRemoteAddress()); | ||
|
||
} | ||
|
||
@Override | ||
public UserContext redecorate(UserContext decorated, UserContext context, | ||
AuthenticatedUser authenticatedUser, Credentials credentials) | ||
throws GuacamoleException { | ||
return new RestrictUserContext(context, credentials.getRemoteAddress()); | ||
} | ||
|
||
} |
Oops, something went wrong.