Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
benjamin.ertl
aai-identity-harmonization
Commits
dd2a57c8
Commit
dd2a57c8
authored
Jan 12, 2016
by
benjamin.ertl
Browse files
annotation app context
parent
5b9b3346
Changes
3
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
dd2a57c8
...
...
@@ -110,6 +110,8 @@
<version>
5.1
</version>
</dependency>
<!-- SAML -->
<!-- Utils -->
<dependency>
<groupId>
com.google.guava
</groupId>
...
...
src/main/java/edu/kit/scc/Main.java
View file @
dd2a57c8
...
...
@@ -5,12 +5,18 @@ import java.util.List;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.xml.XmlBeanFactory
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.support.AbstractApplicationContext
;
import
org.springframework.context.support.ClassPathXmlApplicationContext
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.ldap.core.ContextSource
;
import
org.springframework.ldap.core.LdapTemplate
;
import
org.springframework.ldap.core.support.LdapContextSource
;
import
edu.kit.scc.dao.UserDAO
;
import
edu.kit.scc.dto.UserDTO
;
...
...
@@ -26,6 +32,28 @@ public class Main {
// "997fc6c123b3224b3ade247ea8376164";
// private static String accessToken = "88e3bd6a549e385926378129b330c";
@Bean
LdapContextSource
contextSource
()
{
LdapContextSource
ldapContextSource
=
new
LdapContextSource
();
ldapContextSource
.
setUrl
(
"ldap://192.168.122.202:10389"
);
ldapContextSource
.
setBase
(
"o=sshService"
);
ldapContextSource
.
setUserDn
(
"uid=admin,ou=system"
);
ldapContextSource
.
setPassword
(
"secret"
);
return
ldapContextSource
;
}
@Bean
LdapTemplate
ldapTemplate
(
LdapContextSource
contextSource
)
{
return
new
LdapTemplate
(
contextSource
);
}
@Bean
LDAPUserDAO
ldapUser
(
LdapTemplate
ldapTemplate
)
{
LDAPUserDAO
ldapUserDAO
=
new
LDAPUserDAO
();
ldapUserDAO
.
setLdapTemplate
(
ldapTemplate
);
return
ldapUserDAO
;
}
public
static
void
main
(
String
[]
args
)
{
// OidcClient oidcClient = new OidcClient(clientId, clientSecret,
...
...
@@ -53,7 +81,9 @@ public class Main {
// Resource resource = new ClassPathResource("springldap.xml");
// BeanFactory factory = new XmlBeanFactory(resource);
ApplicationContext
ctx
=
new
ClassPathXmlApplicationContext
(
"springldap.xml"
);
// ApplicationContext ctx = new
// ClassPathXmlApplicationContext("springldap.xml");
ApplicationContext
ctx
=
new
AnnotationConfigApplicationContext
(
Main
.
class
);
UserDAO
ldapUser
=
(
LDAPUserDAO
)
ctx
.
getBean
(
"ldapUser"
);
List
<
UserDTO
>
userList
=
ldapUser
.
getAllUserNames
();
for
(
int
i
=
0
;
i
<
userList
.
size
();
i
++)
...
...
src/main/java/edu/kit/scc/saml/SamlClient.java
deleted
100644 → 0
View file @
5b9b3346
package
edu.kit.scc.saml
;
public
class
SamlClient
{
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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