The-OAG-Development-Project / Application-Gateway

OWASP Application Gateway is an HTTP proxy that handles Oauth2 authentication and session management
https://owasp.org/www-project-application-gateway/
Apache License 2.0
83 stars 4 forks source link

Implement Bean Naming Schema #83

Closed gianlucafrei closed 8 months ago

gianlucafrei commented 3 years ago

Currently we have a bit of anarchy when it comes to bean naming convention. We should implement the following approach for all types of beans (shortName + postfix from variable in interface):

public interface UserMappingFactory {

    /**
     * Name postfix for beans of this type.
     */
    String USER_MAPPER_TYPE_POSTFIX = "-userMapping-factory";

   [...]
}

@Component("jwt-mapping" + USER_MAPPER_TYPE_POSTFIX)
public class JwtTokenMapperFactory implements UserMappingFactory {
    [...]
}
groscy commented 2 years ago

Why not just use the default naming strategy from Spring? (see https://www.baeldung.com/spring-bean-names#1-class-level-annotations) If the classes are named accordingly the post fix can be achieved without any string constants in the interface

groscy commented 2 years ago

Proposal done, but no rights to push on repo

Padi-owasp commented 8 months ago

Proposal looks good, sorry it took us so long. I missed your PR. The notification got stuck in my Spam folder. I'm working to include your proposal and make sure the documentation is in line with the changes too.