Skip to content

Commit

Permalink
Merge pull request #91 from electric-cloud/BEE-17391
Browse files Browse the repository at this point in the history
Add session validation
  • Loading branch information
eserratocb authored Apr 18, 2022
2 parents 1b0f707 + f139531 commit 78ef034
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 14 deletions.
64 changes: 53 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,69 @@

buildscript {
repositories {
maven {
url 'http://dl.bintray.com/ecpluginsdev/maven'
}

jcenter()
mavenCentral()
mavenLocal()
maven {
url 'https://nexus-internal.cloudbees.com/content/groups/mirror'
credentials {
username = System.getenv('NEXUS_USERNAME') ?: nexusUsername
password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword
}
}
}
dependencies {
classpath group: 'com.electriccloud.plugins', name: 'flow-gradle-plugin', version: '+'
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
classpath group: 'com.electriccloud.plugins', name: 'flow-gradle-plugin', version: '2.4'
}
}

repositories {
mavenCentral()
mavenLocal()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
url 'https://nexus-internal.cloudbees.com/content/repositories/snapshots'
credentials {
username = System.getenv('NEXUS_USERNAME') ?: nexusUsername
password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword
}
}
maven {
url 'https://nexus-internal.cloudbees.com/service/local/staging/deploy/maven2'
credentials {
username = System.getenv('NEXUS_USERNAME') ?: nexusUsername
password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword
}
}
maven {
url 'https://nexus-internal.cloudbees.com/content/groups/mirror'
credentials {
username = System.getenv('NEXUS_USERNAME') ?: nexusUsername
password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword
}
}
}

configurations.all {
resolutionStrategy {
force group: 'com.electriccloud', name: 'ec-test', version: '10.1.0'
force group: 'com.electriccloud', name: 'commander-client', version: '10.1.0'
force group: 'com.electriccloud', name: 'commander-sdk', version: '6.1.2.1'
force group: 'com.electriccloud', name: 'ec_internal', version: '6.1.2.1'
force group: 'com.google.gwt', name: 'gwt-user', version: '2.5.0-ec3'
force group: 'com.google.gwt', name: 'gwt-dev', version: '2.5.0-ec1'

// force group: 'com.electriccloud', name: 'commander-client', version: '10.1.0'
// force group: 'com.electriccloud', name: 'commander-sdk', version: '6.1.2.1'
// force group: 'com.electriccloud', name: 'ec_internal', version: '6.1.2.1'
// force group: 'com.google.gwt', name: 'gwt-user', version: '2.5.0-ec3'
// force group: 'com.google.gwt', name: 'gwt-dev', version: '2.5.0-ec1'

cacheChangingModulesFor 0, 'seconds'
}
}

group = "com.electriccloud"
description = "Plugins : EC-OpenStack"
version = "1.3.6"
version = "1.3.7"

apply plugin: 'groovy'
apply plugin: 'flow-gradle-plugin'
Expand All @@ -37,7 +79,7 @@ apply plugin: 'license'
license {
header = file ('shortHeader.txt')
exclude "**/project.xml"
}
}

configurations {
// Configuration for the jar files we want
Expand Down Expand Up @@ -85,7 +127,7 @@ test {
}

task wrapper(type: Wrapper) {
gradleVersion = '2.3'
gradleVersion = '2.13'
}

// Include any dependent jars in the plugin jar file for
Expand Down
18 changes: 18 additions & 0 deletions cgi-bin/openstack.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,24 @@ sub xmlQuote($) {
return $string;
}

################################
# validateUserSession
#
# Check current session on valid, if not - redirects
# user to the login page.
################################
sub validateUserSession() {

my $ec = new ElectricCommander({abortOnError => 0});
$ec->login();
if($ec->getError()) {
print "Location: ../../../\n\n";
exit 0;
}
}

validateUserSession();

main();


Expand Down
18 changes: 18 additions & 0 deletions cgi-bin/openstackMonitor.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,23 @@ sub reportSuccess($) {
print "Success";
}

################################
# validateUserSession
#
# Check current session on valid, if not - redirects
# user to the login page.
################################
sub validateUserSession() {

my $ec = new ElectricCommander({abortOnError => 0});
$ec->login();
if($ec->getError()) {
print "Location: ../../../\n\n";
exit 0;
}
}

validateUserSession();

main();
exit SUCCESS;
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip
8 changes: 6 additions & 2 deletions help/help.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Plugin Version @PLUGIN_VERSION@
Revised on December 25, 2018
Revised on April 14, 2022

== Integrated version

Expand Down Expand Up @@ -789,9 +789,13 @@ image::cloudbees-common::cd-plugins/ec-openstack/use-cases/case-1/cleanup-log.pn
[[rns]]
== Release notes

=== EC-OpenStack 1.3.7

* Added session validation.

=== EC-OpenStack 1.3.6

* The documentation hahs been migrated to the main documentation site.
* The documentation has been migrated to the main documentation site.

=== EC-OpenStack 1.3.5

Expand Down

0 comments on commit 78ef034

Please sign in to comment.