Skip to content

Commit

Permalink
added routes to explore web socket security (#2602)
Browse files Browse the repository at this point in the history
* added simple test-case

* ajax logout working now

* worked

* cleaned out

* removed println
  • Loading branch information
nathandunn committed Apr 5, 2021
1 parent bbf86de commit 6929f87
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Apollo2.X
FROM ubuntu:18.04
MAINTAINER Nathan Dunn <nathandunn@lbl.gov>
MAINTAINER Nathan Dunn GH @nathandunn
ENV DEBIAN_FRONTEND noninteractive


Expand Down
1 change: 0 additions & 1 deletion apollo
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ function check_configs(){

check_node
check_java
check_grails
}

function copy_configs(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1275,12 +1275,17 @@ class AnnotationEditorController extends AbstractApolloController implements Ann
JSONObject rootElement = (JSONObject) JSON.parse(inputString)
rootElement.put(FeatureStringEnum.USERNAME.value, principal.name)


String operation = ((JSONObject) rootElement).get(REST_OPERATION)

String operationName = underscoreToCamelCase(operation)
log.debug "operationName: ${operationName}"
def p = task {
switch (operationName) {
case "currentUser":
User user = permissionService.getCurrentUser(rootElement)
return user as JSON
// test case for websocket
case "ping":
return "pong"
break
Expand Down
6 changes: 3 additions & 3 deletions grails-app/controllers/org/bbop/apollo/LoginController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LoginController extends AbstractApolloController {
def index() {}


def handleOperation(String track, String operation) {
def handleOperation(String operation) {
JSONObject postObject = findPost()
if(postObject?.containsKey(REST_OPERATION)){
operation = postObject.get(REST_OPERATION)
Expand Down Expand Up @@ -200,8 +200,8 @@ class LoginController extends AbstractApolloController {
log.debug "LOGOUT SESSION ${SecurityUtils?.subject?.getSession(false)?.id}"
log.debug "logging out with params: ${params}"
// have to retrive the username first
String username = SecurityUtils.subject.principal
log.debug "sending logout"
String username = SecurityUtils.subject.principal ?: params.username
log.debug "sending logout for username ${username}"
sendLogout(username,params.get(FeatureStringEnum.CLIENT_TOKEN.value).toString())
log.debug "sent logout"
sleep(1000)
Expand Down

0 comments on commit 6929f87

Please sign in to comment.