Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JAMES-1618 Add a AUTHENTICATE command - RFC-5804 compliant
git-svn-id: https://svn.apache.org/repos/asf/james/project/trunk@1720575 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Showing
18 changed files
with
427 additions
and
66 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/AuthenticateTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
/**************************************************************** | |||
* Licensed to the Apache Software Foundation (ASF) under one * | |||
* or more contributor license agreements. See the NOTICE file * | |||
* distributed with this work for additional information * | |||
* regarding copyright ownership. The ASF licenses this file * | |||
* to you under the Apache License, Version 2.0 (the * | |||
* "License"); you may not use this file except in compliance * | |||
* with the License. You may obtain a copy of the License at * | |||
* * | |||
* http://www.apache.org/licenses/LICENSE-2.0 * | |||
* * | |||
* Unless required by applicable law or agreed to in writing, * | |||
* software distributed under the License is distributed on an * | |||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * | |||
* KIND, either express or implied. See the License for the * | |||
* specific language governing permissions and limitations * | |||
* under the License. * | |||
****************************************************************/ | |||
|
|||
package org.apache.james.mpt.testsuite; | |||
|
|||
import com.google.inject.Inject; | |||
import org.apache.james.mpt.host.ManageSieveHostSystem; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
|
|||
import java.util.Locale; | |||
|
|||
public class AuthenticateTest extends ManageSieveMPTTest { | |||
|
|||
@Inject | |||
private static ManageSieveHostSystem hostSystem; | |||
|
|||
public AuthenticateTest() throws Exception { | |||
super(hostSystem); | |||
} | |||
|
|||
@Before | |||
public void setUp() throws Exception { | |||
super.setUp(); | |||
} | |||
|
|||
@Test | |||
public void authenticateShouldWork() throws Exception { | |||
scriptTest("authenticate", Locale.US); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...anagesieve/core/src/main/resources/org/apache/james/managesieve/scripts/authenticate.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
################################################################ | |||
# Licensed to the Apache Software Foundation (ASF) under one # | |||
# or more contributor license agreements. See the NOTICE file # | |||
# distributed with this work for additional information # | |||
# regarding copyright ownership. The ASF licenses this file # | |||
# to you under the Apache License, Version 2.0 (the # | |||
# "License"); you may not use this file except in compliance # | |||
# with the License. You may obtain a copy of the License at # | |||
# # | |||
# http://www.apache.org/licenses/LICENSE-2.0 # | |||
# # | |||
# Unless required by applicable law or agreed to in writing, # | |||
# software distributed under the License is distributed on an # | |||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # | |||
# KIND, either express or implied. See the License for the # | |||
# specific language governing permissions and limitations # | |||
# under the License. # | |||
################################################################ | |||
|
|||
C: AUTHENTICATE | |||
S: NO ManageSieve syntax is incorrect : You must specify a SASL mechanism as an argument of AUTHENTICATE command | |||
|
|||
C: AUTHENTICATE UNKNOWN | |||
S: NO Unknown SASL mechanism UNKNOWN | |||
|
|||
C: AUTHENTICATE "PLAIN" | |||
S: \+ "" | |||
C: GETSCRIPT toto.sieve | |||
S: NO ManageSieve syntax is incorrect : You must supply a password for the authentication mechanism. Formal syntax : <NULL>username<NULL>password | |||
|
|||
C: tin password | |||
S: NO authentication failed | |||
|
|||
C: AUTHENTICATE "PLAIN" | |||
S: \+ "" | |||
C: user password | |||
S: OK authentication successfull |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...s/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,34 @@ | |||
/* | |||
* Licensed to the Apache Software Foundation (ASF) under one | |||
* or more contributor license agreements. See the NOTICE file | |||
* distributed with this work for additional information | |||
* regarding copyright ownership. The ASF licenses this file | |||
* to you under the Apache License, Version 2.0 (the | |||
* "License"); you may not use this file except in compliance | |||
* with the License. You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, | |||
* software distributed under the License is distributed on an | |||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |||
* KIND, either express or implied. See the License for the | |||
* specific language governing permissions and limitations | |||
* under the License. | |||
* | |||
*/ | |||
|
|||
package org.apache.james.managesieve.api; | |||
|
|||
public interface AuthenticationProcessor { | |||
|
|||
String initialServerResponse(Session session); | |||
|
|||
/** | |||
* @return Null if authentication failed, the authenticated username if authentication is successfull | |||
* @throws SyntaxException | |||
* @throws AuthenticationException | |||
*/ | |||
String isAuthenticationSuccesfull(Session session, String suppliedClientData) throws SyntaxException, AuthenticationException; | |||
|
|||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...cols/managesieve/src/main/java/org/apache/james/managesieve/api/UnknownSaslMechanism.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
|
|||
|
|||
package org.apache.james.managesieve.api; | |||
|
|||
public class UnknownSaslMechanism extends ManageSieveException { | |||
|
|||
public UnknownSaslMechanism(String unknownMechanism) { | |||
super("Unknown SASL mechanism " + unknownMechanism); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.