Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ac
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OATS-CADC
ac
Commits
3477988f
Commit
3477988f
authored
10 years ago
by
Dustin Jenkins
Browse files
Options
Downloads
Plain Diff
Merge branch 's1668' of /srv/cadc/git/wopencadc into s1711
parents
cec1067f
a0efe6ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/cadcAccessControl/src/ca/nrc/cadc/ac/client/GMSClient.java
+29
-11
29 additions, 11 deletions
...adcAccessControl/src/ca/nrc/cadc/ac/client/GMSClient.java
with
29 additions
and
11 deletions
projects/cadcAccessControl/src/ca/nrc/cadc/ac/client/GMSClient.java
+
29
−
11
View file @
3477988f
...
...
@@ -122,7 +122,8 @@ public class GMSClient
private
static
final
Logger
log
=
Logger
.
getLogger
(
GMSClient
.
class
);
// socket factory to use when connecting
public
SSLSocketFactory
sslSocketFactory
;
private
SSLSocketFactory
sslSocketFactory
;
private
SSLSocketFactory
mySocketFactory
;
private
String
baseURL
;
...
...
@@ -1028,24 +1029,41 @@ public class GMSClient
*/
public
void
setSSLSocketFactory
(
SSLSocketFactory
sslSocketFactory
)
{
if
(
mySocketFactory
!=
null
)
throw
new
IllegalStateException
(
"Illegal use of GMSClient: "
+
"cannot set SSLSocketFactory after using one created from Subject"
);
this
.
sslSocketFactory
=
sslSocketFactory
;
clearCache
();
}
/**
* @return the sslSocketFactory
*/
private
int
subjectHashCode
=
0
;
private
SSLSocketFactory
getSSLSocketFactory
()
{
if
(
this
.
sslSocketFactory
==
null
)
AccessControlContext
ac
=
AccessController
.
getContext
();
Subject
s
=
Subject
.
getSubject
(
ac
);
// no real Subject: can only use the one from setSSLSocketFactory
if
(
s
==
null
||
s
.
getPrincipals
().
isEmpty
())
{
return
sslSocketFactory
;
}
// lazy init
if
(
this
.
mySocketFactory
==
null
)
{
log
.
debug
(
"getSSLSocketFactory: "
+
s
);
this
.
mySocketFactory
=
SSLUtil
.
getSocketFactory
(
s
);
this
.
subjectHashCode
=
s
.
hashCode
();
}
else
{
log
.
debug
(
"initHTTPS: lazy init"
);
AccessControlContext
a
c
=
AccessController
.
getContext
();
Subject
s
=
Subject
.
getSubject
(
ac
);
this
.
sslSocketFactory
=
SSLUtil
.
getSocketFactory
(
s
);
log
.
debug
(
"Socket Factory: "
+
this
.
ssl
SocketFactory
);
int
c
=
s
.
hashCode
(
);
if
(
c
!
=
subjectHashCode
)
throw
new
IllegalStateException
(
"Illegal use of "
+
this
.
getClass
().
getSimpleName
()
+
": subject change not supported for internal SSL
SocketFactory
"
);
}
return
this
.
ssl
SocketFactory
;
return
this
.
my
SocketFactory
;
}
protected
void
clearCache
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment