Skip to content

Commit 78ef034

Browse files
authored
Merge pull request #91 from electric-cloud/BEE-17391
Add session validation
2 parents 1b0f707 + f139531 commit 78ef034

File tree

5 files changed

+96
-14
lines changed

5 files changed

+96
-14
lines changed

build.gradle

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,69 @@
88

99
buildscript {
1010
repositories {
11-
maven {
12-
url 'http://dl.bintray.com/ecpluginsdev/maven'
13-
}
14-
15-
jcenter()
11+
mavenCentral()
12+
mavenLocal()
13+
maven {
14+
url 'https://nexus-internal.cloudbees.com/content/groups/mirror'
15+
credentials {
16+
username = System.getenv('NEXUS_USERNAME') ?: nexusUsername
17+
password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword
18+
}
19+
}
1620
}
1721
dependencies {
18-
classpath group: 'com.electriccloud.plugins', name: 'flow-gradle-plugin', version: '+'
19-
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
22+
classpath group: 'com.electriccloud.plugins', name: 'flow-gradle-plugin', version: '2.4'
2023
}
2124
}
2225

2326
repositories {
27+
mavenCentral()
28+
mavenLocal()
2429
maven {
25-
url "https://oss.sonatype.org/content/repositories/snapshots"
30+
url 'https://nexus-internal.cloudbees.com/content/repositories/snapshots'
31+
credentials {
32+
username = System.getenv('NEXUS_USERNAME') ?: nexusUsername
33+
password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword
34+
}
35+
}
36+
maven {
37+
url 'https://nexus-internal.cloudbees.com/service/local/staging/deploy/maven2'
38+
credentials {
39+
username = System.getenv('NEXUS_USERNAME') ?: nexusUsername
40+
password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword
41+
}
42+
}
43+
maven {
44+
url 'https://nexus-internal.cloudbees.com/content/groups/mirror'
45+
credentials {
46+
username = System.getenv('NEXUS_USERNAME') ?: nexusUsername
47+
password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword
48+
}
49+
}
50+
}
51+
52+
configurations.all {
53+
resolutionStrategy {
54+
force group: 'com.electriccloud', name: 'ec-test', version: '10.1.0'
55+
force group: 'com.electriccloud', name: 'commander-client', version: '10.1.0'
56+
force group: 'com.electriccloud', name: 'commander-sdk', version: '6.1.2.1'
57+
force group: 'com.electriccloud', name: 'ec_internal', version: '6.1.2.1'
58+
force group: 'com.google.gwt', name: 'gwt-user', version: '2.5.0-ec3'
59+
force group: 'com.google.gwt', name: 'gwt-dev', version: '2.5.0-ec1'
60+
61+
// force group: 'com.electriccloud', name: 'commander-client', version: '10.1.0'
62+
// force group: 'com.electriccloud', name: 'commander-sdk', version: '6.1.2.1'
63+
// force group: 'com.electriccloud', name: 'ec_internal', version: '6.1.2.1'
64+
// force group: 'com.google.gwt', name: 'gwt-user', version: '2.5.0-ec3'
65+
// force group: 'com.google.gwt', name: 'gwt-dev', version: '2.5.0-ec1'
66+
67+
cacheChangingModulesFor 0, 'seconds'
2668
}
2769
}
2870

2971
group = "com.electriccloud"
3072
description = "Plugins : EC-OpenStack"
31-
version = "1.3.6"
73+
version = "1.3.7"
3274

3375
apply plugin: 'groovy'
3476
apply plugin: 'flow-gradle-plugin'
@@ -37,7 +79,7 @@ apply plugin: 'license'
3779
license {
3880
header = file ('shortHeader.txt')
3981
exclude "**/project.xml"
40-
}
82+
}
4183

4284
configurations {
4385
// Configuration for the jar files we want
@@ -85,7 +127,7 @@ test {
85127
}
86128

87129
task wrapper(type: Wrapper) {
88-
gradleVersion = '2.3'
130+
gradleVersion = '2.13'
89131
}
90132

91133
// Include any dependent jars in the plugin jar file for

cgi-bin/openstack.cgi

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,24 @@ sub xmlQuote($) {
216216
return $string;
217217
}
218218

219+
################################
220+
# validateUserSession
221+
#
222+
# Check current session on valid, if not - redirects
223+
# user to the login page.
224+
################################
225+
sub validateUserSession() {
226+
227+
my $ec = new ElectricCommander({abortOnError => 0});
228+
$ec->login();
229+
if($ec->getError()) {
230+
print "Location: ../../../\n\n";
231+
exit 0;
232+
}
233+
}
234+
235+
validateUserSession();
236+
219237
main();
220238

221239

cgi-bin/openstackMonitor.cgi

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,23 @@ sub reportSuccess($) {
198198
print "Success";
199199
}
200200

201+
################################
202+
# validateUserSession
203+
#
204+
# Check current session on valid, if not - redirects
205+
# user to the login page.
206+
################################
207+
sub validateUserSession() {
208+
209+
my $ec = new ElectricCommander({abortOnError => 0});
210+
$ec->login();
211+
if($ec->getError()) {
212+
print "Location: ../../../\n\n";
213+
exit 0;
214+
}
215+
}
216+
217+
validateUserSession();
218+
201219
main();
202220
exit SUCCESS;

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip

help/help.adoc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
Plugin Version @PLUGIN_VERSION@
3-
Revised on December 25, 2018
3+
Revised on April 14, 2022
44

55
== Integrated version
66

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

792+
=== EC-OpenStack 1.3.7
793+
794+
* Added session validation.
795+
792796
=== EC-OpenStack 1.3.6
793797

794-
* The documentation hahs been migrated to the main documentation site.
798+
* The documentation has been migrated to the main documentation site.
795799

796800
=== EC-OpenStack 1.3.5
797801

0 commit comments

Comments
 (0)