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
25f2eba6
Commit
25f2eba6
authored
Mar 07, 2016
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #557 from guusdk/OF-1092
OF-1092 Various fixes
parents
7adf9c58
10e0cc48
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
19 deletions
+25
-19
SASLAuthentication.java
...ava/org/jivesoftware/openfire/net/SASLAuthentication.java
+1
-1
SaslProvider.java
src/java/org/jivesoftware/openfire/sasl/SaslProvider.java
+9
-6
SaslServerFactoryImpl.java
...org/jivesoftware/openfire/sasl/SaslServerFactoryImpl.java
+15
-12
No files found.
src/java/org/jivesoftware/openfire/net/SASLAuthentication.java
View file @
25f2eba6
...
...
@@ -230,7 +230,7 @@ public class SASLAuthentication {
// Construct the configuration properties
final
Map
<
String
,
Object
>
props
=
new
HashMap
<>();
props
.
put
(
LocalClientSession
.
class
.
getCanonicalName
(),
session
);
props
.
put
(
Sasl
.
POLICY_NOANONYMOUS
,
!
XMPPServer
.
getInstance
().
getIQAuthHandler
().
isAnonymousAllowed
(
)
);
props
.
put
(
Sasl
.
POLICY_NOANONYMOUS
,
Boolean
.
toString
(
!
XMPPServer
.
getInstance
().
getIQAuthHandler
().
isAnonymousAllowed
()
)
);
SaslServer
saslServer
=
Sasl
.
createSaslServer
(
mechanismName
,
"xmpp"
,
session
.
getServerName
(),
props
,
new
XMPPCallbackHandler
()
);
if
(
saslServer
==
null
)
...
...
src/java/org/jivesoftware/openfire/sasl/SaslProvider.java
View file @
25f2eba6
...
...
@@ -33,11 +33,14 @@ public class SaslProvider extends Provider {
/**
* Constructs a the JiveSoftware SASL provider.
*/
public
SaslProvider
()
{
super
(
"JiveSoftware"
,
1.0
,
"JiveSoftware SASL provider v1.0, implementing server mechanisms for: PLAIN, SCRAM-SHA-1"
);
// Add SaslServer supporting the PLAIN SASL mechanism
put
(
"SaslServerFactory.PLAIN"
,
"org.jivesoftware.openfire.sasl.SaslServerFactoryImpl"
);
// Add SaslServer supporting the SCRAM-SHA-1 SASL mechanism
put
(
"SaslServerFactory.SCRAM-SHA-1"
,
"org.jivesoftware.openfire.sasl.SaslServerFactoryImpl"
);
public
SaslProvider
()
{
super
(
"JiveSoftware"
,
1.1
,
"JiveSoftware Openfire SASL provider v1.1"
);
final
SaslServerFactoryImpl
serverFactory
=
new
SaslServerFactoryImpl
();
for
(
final
String
name
:
serverFactory
.
getMechanismNames
(
null
)
)
{
put
(
"SaslServerFactory."
+
name
,
serverFactory
.
getClass
().
getCanonicalName
()
);
}
}
}
\ No newline at end of file
src/java/org/jivesoftware/openfire/sasl/SaslServerFactoryImpl.java
View file @
25f2eba6
...
...
@@ -55,8 +55,8 @@ public class SaslServerFactoryImpl implements SaslServerFactory
public
SaslServerFactoryImpl
()
{
allMechanisms
=
new
HashSet
<>();
allMechanisms
.
add
(
new
Mechanism
(
"PLAIN"
,
tru
e
,
true
)
);
allMechanisms
.
add
(
new
Mechanism
(
"SCRAM
_SHA_
1"
,
false
,
false
)
);
allMechanisms
.
add
(
new
Mechanism
(
"PLAIN"
,
fals
e
,
true
)
);
allMechanisms
.
add
(
new
Mechanism
(
"SCRAM
-SHA-
1"
,
false
,
false
)
);
allMechanisms
.
add
(
new
Mechanism
(
"JIVE-SHAREDSECRET"
,
true
,
false
)
);
allMechanisms
.
add
(
new
Mechanism
(
"EXTERNAL"
,
false
,
false
)
);
}
...
...
@@ -73,14 +73,14 @@ public class SaslServerFactoryImpl implements SaslServerFactory
switch
(
mechanism
.
toUpperCase
()
)
{
case
"PLAIN"
:
if
(
cbh
!
=
null
)
if
(
cbh
=
=
null
)
{
Log
.
debug
(
"Unable to instantiate {} SaslServer: A callbackHandler with support for Password, Name, and AuthorizeCallback required."
,
mechanism
);
return
null
;
}
return
new
SaslServerPlainImpl
(
protocol
,
serverName
,
props
,
cbh
);
case
"SCRAM
_SHA_
1"
:
case
"SCRAM
-SHA-
1"
:
return
new
ScramSha1SaslServer
();
case
"ANONYMOUS"
:
...
...
@@ -132,16 +132,19 @@ public class SaslServerFactoryImpl implements SaslServerFactory
for
(
final
Mechanism
mechanism
:
allMechanisms
)
{
if
(
mechanism
.
allowsAnonymous
&&
props
.
containsKey
(
Sasl
.
POLICY_NOANONYMOUS
)
&&
Boolean
.
parseBoolean
(
(
String
)
props
.
get
(
Sasl
.
POLICY_NOANONYMOUS
)
)
)
if
(
props
!=
null
)
{
// Do not include a mechanism that allows anonymous authentication when the 'no anonymous' policy is set.
continue
;
}
if
(
mechanism
.
allowsAnonymous
&&
props
.
containsKey
(
Sasl
.
POLICY_NOANONYMOUS
)
&&
Boolean
.
parseBoolean
(
(
String
)
props
.
get
(
Sasl
.
POLICY_NOANONYMOUS
)
)
)
{
// Do not include a mechanism that allows anonymous authentication when the 'no anonymous' policy is set.
continue
;
}
if
(
mechanism
.
isPlaintext
&&
props
.
containsKey
(
Sasl
.
POLICY_NOPLAINTEXT
)
&&
Boolean
.
parseBoolean
(
(
String
)
props
.
get
(
Sasl
.
POLICY_NOPLAINTEXT
)
)
)
{
// Do not include a mechanism that is susceptible to simple plain passive attacks when the 'no plaintext' policy is set.
continue
;
if
(
mechanism
.
isPlaintext
&&
props
.
containsKey
(
Sasl
.
POLICY_NOPLAINTEXT
)
&&
Boolean
.
parseBoolean
(
(
String
)
props
.
get
(
Sasl
.
POLICY_NOPLAINTEXT
)
)
)
{
// Do not include a mechanism that is susceptible to simple plain passive attacks when the 'no plaintext' policy is set.
continue
;
}
}
// Mechanism passed all filters. It should be part of the result.
...
...
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