Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The OAuth/OpenID AuthenticatorProvider has no UserContext and so GuacamoleTrigger fails #8

Open
adb014 opened this issue Nov 8, 2024 · 1 comment

Comments

@adb014
Copy link

adb014 commented Nov 8, 2024

The problem is in the title. The fix I'm using is

diff --git a/src/main/java/org/apache/guacamole/guacamoletrigger/auth/TriggerUserContext.java b/src/main/java/org/apache/guacamole/guacamoletrigger/auth/TriggerUserContext.java
index acc9b4a..e88993b 100644
--- a/src/main/java/org/apache/guacamole/guacamoletrigger/auth/TriggerUserContext.java
+++ b/src/main/java/org/apache/guacamole/guacamoletrigger/auth/TriggerUserContext.java
@@ -120,7 +120,13 @@ public class TriggerUserContext extends AbstractUserContext {
         //
         // }
         // String userName = authUser.getCredentials().getUsername();
-        String userName = authUser.getAuthenticationProvider().getUserContext(authUser).self().getIdentifier();
+        String userName;
+        if (authUser.getAuthenticationProvider().getIdentifier() == "openid"){
+            // The OAuth/OpenID Authentication Provider has no UserContext
+            userName = authUser.getIdentifier();
+        } else {
+            userName = authUser.getAuthenticationProvider().getUserContext(authUser).self().getIdentifier();
+        }
 
         if (userName == null){
 

The edit of the message was to fix the patch that was initially incorrect

@adb014
Copy link
Author

adb014 commented Nov 8, 2024

See the definition of getUserContext for OAuth/OpenID to see that this is so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant