You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2017/09/27 02:17:56 UTC
[04/29] incubator-guacamole-client git commit: GUACAMOLE-210: Add
stub OAuthAuthenticationProvider.
GUACAMOLE-210: Add stub OAuthAuthenticationProvider.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/67c817af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/67c817af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/67c817af
Branch: refs/heads/master
Commit: 67c817af9ff1da7729a03205b929119f6d020027
Parents: b64247d
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Jan 1 19:54:58 2016 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Sep 25 13:06:42 2017 -0700
----------------------------------------------------------------------
extensions/guacamole-auth-openid/pom.xml | 84 ++++++++++++++++++++
.../auth/oauth/OAuthAuthenticationProvider.java | 83 +++++++++++++++++++
.../src/main/resources/guac-manifest.json | 12 +++
pom.xml | 1 +
4 files changed, 180 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/67c817af/extensions/guacamole-auth-openid/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-openid/pom.xml b/extensions/guacamole-auth-openid/pom.xml
new file mode 100644
index 0000000..bc62695
--- /dev/null
+++ b/extensions/guacamole-auth-openid/pom.xml
@@ -0,0 +1,84 @@
+<?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-openid</artifactId>
+ <packaging>jar</packaging>
+ <version>0.9.9</version>
+ <name>guacamole-auth-openid</name>
+ <url>http://guacamole.incubator.apache.org/</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <!-- Written for 1.6 -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <!-- Guacamole Extension API -->
+ <dependency>
+ <groupId>org.glyptodon.guacamole</groupId>
+ <artifactId>guacamole-ext</artifactId>
+ <version>0.9.9</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Google OAuth Client API -->
+ <dependency>
+ <groupId>com.google.oauth-client</groupId>
+ <artifactId>google-oauth-client</artifactId>
+ <version>1.21.0</version>
+ </dependency>
+
+ <!-- Guice -->
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ <version>3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ <version>3.0</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/67c817af/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/oauth/OAuthAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/oauth/OAuthAuthenticationProvider.java b/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/oauth/OAuthAuthenticationProvider.java
new file mode 100644
index 0000000..55f40b1
--- /dev/null
+++ b/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/oauth/OAuthAuthenticationProvider.java
@@ -0,0 +1,83 @@
+/*
+ * 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.oauth;
+
+import org.glyptodon.guacamole.GuacamoleException;
+import org.glyptodon.guacamole.net.auth.AuthenticatedUser;
+import org.glyptodon.guacamole.net.auth.AuthenticationProvider;
+import org.glyptodon.guacamole.net.auth.Credentials;
+import org.glyptodon.guacamole.net.auth.UserContext;
+import org.glyptodon.guacamole.net.auth.credentials.CredentialsInfo;
+import org.glyptodon.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException;
+
+/**
+ * Guacamole authentication backend which authenticates users using an
+ * arbitrary external system implementing OAuth. No storage for connections is
+ * provided - only authentication. Storage must be provided by some other
+ * extension.
+ */
+public class OAuthAuthenticationProvider implements AuthenticationProvider {
+
+ @Override
+ public String getIdentifier() {
+ return "oauth";
+ }
+
+ @Override
+ public AuthenticatedUser authenticateUser(Credentials credentials)
+ throws GuacamoleException {
+
+ // STUB
+ throw new GuacamoleInvalidCredentialsException(
+ "Invalid login.",
+ CredentialsInfo.USERNAME_PASSWORD
+ );
+
+ }
+
+ @Override
+ public AuthenticatedUser updateAuthenticatedUser(
+ AuthenticatedUser authenticatedUser, Credentials credentials)
+ throws GuacamoleException {
+
+ // No update necessary
+ return authenticatedUser;
+
+ }
+
+ @Override
+ public UserContext getUserContext(AuthenticatedUser authenticatedUser)
+ throws GuacamoleException {
+
+ // No associated data whatsoever
+ return null;
+
+ }
+
+ @Override
+ public UserContext updateUserContext(UserContext context,
+ AuthenticatedUser authenticatedUser) throws GuacamoleException {
+
+ // No update necessary
+ return context;
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/67c817af/extensions/guacamole-auth-openid/src/main/resources/guac-manifest.json
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-openid/src/main/resources/guac-manifest.json b/extensions/guacamole-auth-openid/src/main/resources/guac-manifest.json
new file mode 100644
index 0000000..77dd709
--- /dev/null
+++ b/extensions/guacamole-auth-openid/src/main/resources/guac-manifest.json
@@ -0,0 +1,12 @@
+{
+
+ "guacamoleVersion" : "0.9.9",
+
+ "name" : "OAuth Authentication Extension",
+ "namespace" : "guac-oauth",
+
+ "authProviders" : [
+ "org.apache.guacamole.auth.oauth.OAuthAuthenticationProvider"
+ ]
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/67c817af/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 41317a3..55228f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,6 +55,7 @@
<module>extensions/guacamole-auth-jdbc</module>
<module>extensions/guacamole-auth-ldap</module>
<module>extensions/guacamole-auth-noauth</module>
+ <module>extensions/guacamole-auth-openid</module>
<!-- Example web applications using the Guacamole APIs -->
<module>doc/guacamole-example</module>