Skip to content

Commit a4d6a57

Browse files
committed
Added BlackList test
1 parent bf4492a commit a4d6a57

File tree

2 files changed

+12
-2
lines changed
  • CrossSiteScripting/src/main

2 files changed

+12
-2
lines changed

CrossSiteScripting/src/main/groovy/io/github/javaconductor/gserv/examples/crosssite/Main.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class Main {
3737
cors('/public', allowAll(3600))
3838
cors('/private/*', whiteList(3600, hostList))
3939
cors('/internal', whiteList(3600, hostListWithLocalhost))
40+
cors('/hidden', blackList(3600, hostListWithLocalhost))
4041

4142
useResourceDocs(true)
4243

@@ -51,6 +52,9 @@ class Main {
5152
get('/internal'){ ->
5253
write( "This is the internal message.")
5354
}
55+
get('/hidden'){ ->
56+
write( "This is the hidden message.")
57+
}
5458

5559
}.start(60001);
5660
};

CrossSiteScripting/src/main/resources/docs/crosssite/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<body>
1010

1111
<script>
12-
var internal = 0,public = 1, private=2;
13-
var paths = ['internal','public','private']
12+
var internal = 0,public = 1, private= 2,hidden=3;
13+
var paths = ['internal','public','private','hidden']
1414
function showMessage (selector, which){
1515
var promise = callServer(which, selector);
1616
promise.then( function( msg ) {
@@ -32,6 +32,10 @@
3232
showMessage(selector, internal);
3333
};
3434

35+
function showHidden (selector){
36+
showMessage(selector, hidden);
37+
};
38+
3539
function callServer(which, selector){
3640
var host = location.hostname;
3741
var url = "http://"+host + ":60001/"+(paths[which] );
@@ -45,10 +49,12 @@
4549
<button id="showPublic">Show Public</button>
4650
<button id="showPrivate">Show Private</button><br/>
4751
<button id="showInternal">Show Internal</button><br/>
52+
<button id="showHidden">Show Hidden</button><br/>
4853
<textarea id="message"></textarea>
4954

5055
<script>
5156
$(function(){
57+
$("#showHidden").click( function(){ showHidden("#message" ); })
5258
$("#showInternal").click( function(){ showInternal("#message" ); })
5359
$("#showPublic").click( function(){ showPublic("#message" ); })
5460
$("#showPrivate").click( function(){ showPrivate("#message" ); })

0 commit comments

Comments
 (0)