Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
8093fed7
Commit
8093fed7
authored
Nov 15, 2014
by
daryl herzmann
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #117 from tevans/OF-189
OF-189: Remove com.sun.* imports
parents
b3d5605f
a93e8689
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
7 deletions
+28
-7
pack200task.jar
build/lib/ant/pack200task.jar
+0
-0
SaslServerFactoryImpl.java
...org/jivesoftware/openfire/sasl/SaslServerFactoryImpl.java
+28
-7
No files found.
build/lib/ant/pack200task.jar
deleted
100644 → 0
View file @
b3d5605f
File deleted
src/java/org/jivesoftware/openfire/sasl/SaslServerFactoryImpl.java
View file @
8093fed7
...
...
@@ -21,11 +21,13 @@
package
org
.
jivesoftware
.
openfire
.
sasl
;
import
java.util.Map
;
import
javax.security.auth.callback.CallbackHandler
;
import
javax.security.sasl.SaslServerFactory
;
import
javax.security.sasl.SaslServer
;
import
javax.security.sasl.Sasl
;
import
javax.security.sasl.SaslException
;
import
com.sun.security.sasl.util.PolicyUtils
;
import
javax.security.sasl.SaslServer
;
import
javax.security.sasl.SaslServerFactory
;
import
org.jivesoftware.openfire.clearspace.ClearspaceSaslServer
;
/**
...
...
@@ -37,7 +39,6 @@ import org.jivesoftware.openfire.clearspace.ClearspaceSaslServer;
public
class
SaslServerFactoryImpl
implements
SaslServerFactory
{
private
static
final
String
myMechs
[]
=
{
"PLAIN"
,
"CLEARSPACE"
};
private
static
final
int
mechPolicies
[]
=
{
PolicyUtils
.
NOANONYMOUS
,
PolicyUtils
.
NOANONYMOUS
};
private
static
final
int
PLAIN
=
0
;
private
static
final
int
CLEARSPACE
=
1
;
...
...
@@ -57,13 +58,13 @@ public class SaslServerFactoryImpl implements SaslServerFactory {
*/
public
SaslServer
createSaslServer
(
String
mechanism
,
String
protocol
,
String
serverName
,
Map
<
String
,
?>
props
,
CallbackHandler
cbh
)
throws
SaslException
{
if
(
mechanism
.
equals
(
myMechs
[
PLAIN
])
&&
PolicyUtils
.
checkPolicy
(
mechPolicies
[
PLAIN
],
props
))
{
if
(
mechanism
.
equals
(
myMechs
[
PLAIN
])
&&
checkPolicy
(
props
))
{
if
(
cbh
==
null
)
{
throw
new
SaslException
(
"CallbackHandler with support for Password, Name, and AuthorizeCallback required"
);
}
return
new
SaslServerPlainImpl
(
protocol
,
serverName
,
props
,
cbh
);
}
else
if
(
mechanism
.
equals
(
myMechs
[
CLEARSPACE
])
&&
PolicyUtils
.
checkPolicy
(
mechPolicies
[
CLEARSPACE
],
props
))
{
else
if
(
mechanism
.
equals
(
myMechs
[
CLEARSPACE
])
&&
checkPolicy
(
props
))
{
if
(
cbh
==
null
)
{
throw
new
SaslException
(
"CallbackHandler with support for AuthorizeCallback required"
);
}
...
...
@@ -73,12 +74,32 @@ public class SaslServerFactoryImpl implements SaslServerFactory {
}
/**
* Requires supported mechanisms to allow anonymous logins
*
* @param props The security properties to check
* @return true if the policy allows anonymous logins
*/
private
boolean
checkPolicy
(
Map
<
String
,
?>
props
)
{
boolean
result
=
true
;
if
(
props
!=
null
)
{
String
policy
=
(
String
)
props
.
get
(
Sasl
.
POLICY_NOANONYMOUS
);
if
(
Boolean
.
parseBoolean
(
policy
))
{
result
=
false
;
}
}
return
result
;
}
/**
* Returns an array of names of mechanisms that match the specified mechanism selection policies.
* @param props The possibly null set of properties used to specify the security policy of the SASL mechanisms.
* @return A non-null array containing a IANA-registered SASL mechanism names.
*/
public
String
[]
getMechanismNames
(
Map
<
String
,
?>
props
)
{
return
PolicyUtils
.
filterMechs
(
myMechs
,
mechPolicies
,
props
);
if
(
checkPolicy
(
props
))
{
return
myMechs
;
}
return
new
String
[]
{
};
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment