jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.5k stars 4.02k forks source link

Outdate LDAP Document #15577

Closed vw98075 closed 11 months ago

vw98075 commented 3 years ago
Overview of the issue

We need to integrate LDAP to a Jhipster app. We find a document on the subject https://www.jhipster.tech/tips/016_tip_ldap_authentication.html#ldap-authentication

After adding

  compile group: 'org.springframework.security', name: 'spring-security-ldap', version: spring_security_version

to the build file, we add

    @Inject
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.ldapAuthentication()
            .userSearchBase("o=myO,ou=myOu") //don't add the base
            .userSearchFilter("(uid={0})")
            .groupSearchBase("ou=Groups") //don't add the base
            .groupSearchFilter("member={0}")
            .contextSource(getContextSource());
    }
    @Bean
    public LdapContextSource getContextSource() {
          LdapContextSource contextSource = new LdapContextSource();
        contextSource.setUrl("ldap://[IP goes here]:[port goes here]");
        contextSource.setBase("dc=mycompany,dc=com");
        contextSource.setUserDn("cn=aUserUid,dc=mycompany,dc=com");
        contextSource.setPassword("hisPassword");
        contextSource.afterPropertiesSet(); //needed otherwise you will have a NullPointerException in spring

        return contextSource;
    }

The about code isn't compilable. For example, the annotation can't be found in the dependencies.

Motivation for or Use Case

Keep document usaful.

Reproduce the error
Related issues
Suggest a Fix

Keep document current

JHipster Version(s)

7.1.0

JHipster configuration
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "baseName": "myapp",
    "jhipsterVersion": "7.1.0",
    "skipClient": false,
    "skipServer": false,
    "skipUserManagement": false,
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "testFrameworks": ["cypress", "gatling"],
    "blueprints": [],
    "otherModules": [],
    "pages": [],
    "creationTimestamp": 1625095262715,
    "serviceDiscoveryType": false,
    "reactive": false,
    "authenticationType": "jwt",
    "packageName": "com.abc.myapp",
    "serverPort": "8080",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "buildTool": "gradle",
    "serverSideOptions": [],
    "websocket": false,
    "searchEngine": false,
    "messageBroker": false,
    "enableSwaggerCodegen": false,
    "clientFramework": "vue",
    "withAdminUi": true,
    "clientTheme": "cosmo",
    "clientThemeVariant": "primary",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "packageFolder": "com/innowake/components/ammcareers",
    "jwtSecretKey": "NThkZDg5YjE3OTkxNGU2YjUzNjAwODMwZjY4ODRiYmIyOWVkN2Q0NmZhMjZhNDU4MmQyYTQ5NDcxOWZlODRjY2ZhYWE5NjNjZWJkZDUyYzljYTU0NmU0OGExZDY4N2EwZjljZWQwMTliYWU3NGZiZTQ3NDQ1MGIwOTNjZDU3NmE=",
    "devServerPort": 9060,
    "clientPackageManager": "npm",
    "languages": ["en", "de"]
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory

No entities are created yet

Browsers and Operating System
gmarziou commented 3 years ago

This is a tip contributed by community, please consider contributing its update.

https://github.com/jhipster/jhipster.github.io/blob/main/tips/016_tip_ldap_authentication.md

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days

vw98075 commented 3 years ago

I don't have time to do anything regarding this problem. The page possibly shall be removed due to the out-of-date content.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days

mraible commented 2 years ago

@vw98075 Do you still think we should remove it? I agree it's a good idea if it doesn't work.

vw98075 commented 2 years ago

The document is way outdated as the sample code can't get complied with. It shall be removed if it doesn't help anybody.

gmarziou commented 2 years ago

I see it as a starting point, so I'm against removing it. A note could be added that warns readers and asks for contribution.

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days