Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace user/pass with sessionId after successful login #81

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/omero/gateway/Gateway.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*------------------------------------------------------------------------------
* Copyright (C) 2015-2022 University of Dundee. All rights reserved.
* Copyright (C) 2015-2023 University of Dundee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -294,6 +294,7 @@ public ExperimenterData connect(LoginCredentials c)
try {
SessionWrapper session = createSession(c);
loggedInUser = login(session, c);
c.setSessionId(session.client.getSessionId());
connected = true;
return loggedInUser;
} catch (CannotCreateSessionException e) {
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/omero/gateway/LoginCredentials.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*------------------------------------------------------------------------------
* Copyright (C) 2015-2017 University of Dundee. All rights reserved.
* Copyright (C) 2015-2023 University of Dundee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -286,4 +286,12 @@ public void setCheckVersion(boolean checkVersion) {
this.checkVersion = checkVersion;
}

/**
* Replaces username and password with the sessionId
* @param sessionId The sessionId
*/
public void setSessionId(String sessionId) {
this.user.setUsername(sessionId);
this.user.setPassword(sessionId);
}
}