[ 
https://issues.apache.org/jira/browse/JAMES-2657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16762135#comment-16762135
 ] 

ASF GitHub Bot commented on JAMES-2657:
---------------------------------------

Github user mbaechler commented on a diff in the pull request:

    https://github.com/apache/james-project/pull/148#discussion_r254445858
  
    --- Diff: 
protocols/netty/src/main/java/org/apache/james/protocols/netty/SslEngineUtil.java
 ---
    @@ -0,0 +1,103 @@
    +/****************************************************************
    + * 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.protocols.netty;
    +
    +import org.jboss.netty.channel.Channel;
    +
    +import javax.net.ssl.SSLContext;
    +import javax.net.ssl.SSLEngine;
    +import java.net.InetSocketAddress;
    +
    +public enum SslEngineUtil {
    +    INSTANCE;
    --- End diff --
    
    We usually use Singleton only for immutable things (and it looks like the 
class is mutable here).
    What I suggest is to declare 5 static factories like:
    ```java
    public static SslEngineUtil remoteOnly();
    ```
    First, it allows to have a single instance if we think it worth limiting 
the number of instance.
    Second, all instances will share the same type. We will be able to pass it 
to our code as a dependency and choose the implementation in the right place.
    Third, there's no global shared mutable anymore (and we would be happy 
about that).
    
    WDYT ?
    
    If you need a hand, I can try to write the solution I have in mind 
tomorrow, just let me know. 


> SSLEngine and SslHandler unaware of remote ip and port
> ------------------------------------------------------
>
>                 Key: JAMES-2657
>                 URL: https://issues.apache.org/jira/browse/JAMES-2657
>             Project: James Server
>          Issue Type: Bug
>            Reporter: Randymo
>            Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Our team uses the remote ip of the connect to determine the ssl cert we use 
> for the connection. We had to make changes on our end to make that accessible 
> to us at the level we needed it. It would be nice if James did this 
> automatically itself.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to