GUACAMOLE-210: Add OAuth code/link field.

This commit is contained in:
Michael Jumper
2016-01-02 00:22:08 -08:00
parent c7d5bd69aa
commit 89f25a9467
5 changed files with 71 additions and 2 deletions

View File

@@ -65,7 +65,7 @@ public class OAuthCodeField extends Field {
String redirectURI) {
// Init base field properties
super(OAUTH_CODE_PARAMETER_NAME, "OAUTH_CODE");
super(OAUTH_CODE_PARAMETER_NAME, "GUAC_OAUTH_CODE");
// Build authorization URI from given values
try {

View File

@@ -7,6 +7,15 @@
"authProviders" : [
"org.apache.guacamole.auth.oauth.OAuthAuthenticationProvider"
]
],
"js" : [
"oauthModule.js",
"oauthConfig.js"
],
"resources" : {
"oauthCodeField.html" : "text/html"
}
}

View File

@@ -0,0 +1 @@
<a href="{{field.authorizationURI}}">Log in using OAuth</a>

View File

@@ -0,0 +1,31 @@
/*
* 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.
*/
/**
* Config block which registers OAuth-specific field types.
*/
angular.module('guacOAuth').config(['formServiceProvider',
function guacOAuthConfig(formServiceProvider) {
// Define field for code from OAuth service
formServiceProvider.registerFieldType("GUAC_OAUTH_CODE", {
templateUrl : 'app/ext/guac-oauth/oauthCodeField.html'
});
}]);

View File

@@ -0,0 +1,28 @@
/*
* 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.
*/
/**
* Module which provides handling for OAuth authentication.
*/
angular.module('guacOAuth', [
'form'
]);
// Ensure the OAuth module is loaded along with the rest of the app
angular.module('index').requires.push('guacOAuth');