]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.security.core/src/org/argeo/security/core/InternalAuthenticationProvider.java
Reduce CMS size
[lgpl/argeo-commons.git] / org.argeo.security.core / src / org / argeo / security / core / InternalAuthenticationProvider.java
1 package org.argeo.security.core;
2
3 import org.springframework.security.authentication.AuthenticationProvider;
4 import org.springframework.security.core.Authentication;
5 import org.springframework.security.core.AuthenticationException;
6
7 public class InternalAuthenticationProvider implements AuthenticationProvider {
8 private String key;
9
10 @Override
11 public Authentication authenticate(Authentication arg0)
12 throws AuthenticationException {
13 InternalAuthentication authentication = (InternalAuthentication) arg0;
14 if (authentication.getCredentials().toString().equals(key))
15 return authentication;
16 return null;
17 }
18
19 public void setKey(String key) {
20 this.key = key;
21 }
22
23 @Override
24 public boolean supports(Class<?> authentication) {
25 return InternalAuthentication.class.isAssignableFrom(authentication);
26 }
27
28 }