Tag: authentication

使用SAMLResponse令牌

基于SAML sp的身份validation具有以下简短的工作流程 用户想要在sp访问应用程序。 sp将SAMLRequest令牌发送到idp。 idp使用它并生成SAMLResponse令牌。 idp将此SAMLResponse令牌发送到sp给出的AC-URL。 我的问题是sp如何使用此SAMLResponse令牌。 逻辑是什么? 如果我能获得一些JAVA代码帮助它将是有益的。

无需身份validation即可在javax.mail中发送邮件

我使用javax.mail在Java中发送邮件。 既然我的项目概念的一部分发生了变化,我必须发送邮件而不进行身份validation。 我将不得不改变我的createSession()方法: private void createSession() { properties.put(“mail.smtp.auth”, “true”); properties.put(“mail.smtp.starttls.enable”, “true”); properties.put(“mail.smtp.host”, server); properties.put(“mail.smtp.port”, port); session = Session.getInstance(properties, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); } 很明显我应该将mail.smtp.auth更改为false ,但我还应该改变什么呢?

Spring安全切换到Ldap身份validation和数据库权限

我为我的网页和Web服务实现了数据库身份validation。 它适用于两者,现在我必须添加Ldap身份validation。 我必须通过远程Ldap服务器进行身份validation(使用用户名和密码),如果用户存在,我必须使用我的数据库作为用户角色(在我的数据库用户名中是与Ldap相同的用户名)。 所以我必须从我的实际代码切换到Ldap和数据库身份validation,如上所述。 我的代码是:SecurityConfig类 @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true, proxyTargetClass = true) public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired @Qualifier(“userDetailsService”) UserDetailsService userDetailsService; @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); } @Bean public PasswordEncoder passwordEncoder(){ PasswordEncoder encoder = new BCryptPasswordEncoder(); return encoder; } @Configuration @Order(1) public static class ApiWebSecurityConfig extends […]

REST服务上的身份validation令牌是什么意思

使用REST Web服务时使用身份validation令牌的价值是什么,而不是每次发出请求时通过HTTPS /加密发送用户名,密码? 据我所知,例如OAUTH有一些好处,因为您不需要将密码泄露给第三方,您可以将令牌传递给您不想共享用户名/密码的受信任第三方。等等 但除了上面我特别不需要的特殊好处之外,为什么我会使用令牌而不是每次都发送用户名/密码。 这可能是为了让客户端轻松生活,而且不必每次都发送用户名/密码。 好吧,但现在客户端必须记住我的令牌,并在每个请求上发送令牌。 因此,现在不是记住/发送用户名/密码,而是为令牌做同样的事情! 所以客户端实现代码不会少。 那么这里的真正价值是什么?

如何在Dropwizard中进行资源的基本身份validation

我相信我有基本的身份validation工作,但我不知道如何保护资源,以便只有在用户登录时才能访问它们。 public class SimpleAuthenticator implements Authenticator { UserDAO userDao; public SimpleAuthenticator(UserDAO userDao) {this.userDao = userDao;} @Override public Optional authenticate(BasicCredentials credentials) throws AuthenticationException { User user = this.userDao.getUserByName(credentials.getUsername()); if (user!=null && user.getName().equalsIgnoreCase(credentials.getUsername()) && BCrypt.checkpw(credentials.getPassword(), user.getPwhash())) { return Optional.of(new User(credentials.getUsername())); } return Optional.absent(); } } 我的Signin资源是这样的: @Path(“/myapp”) @Produces(MediaType.APPLICATION_JSON) public class UserResource { @GET @Path(“/signin”) public User signin(@Auth […]

Struts 2 – 在身份validation拦截器之后重定向到正确的操作

我在网上找不到任何东西所以我会问这里。 我正在使用strut2并且我有一个私有的操作包,因为某些操作需要登录才能访问。 所以我在我的安全包中有这个: dologin html/error/hibernate_session.jsp html/error/hibernate_session.jsp 当然还有其他动作定义。 我的问题如下: 假设用户想要访问他的个人区域。 他点击了personalArea链接,他将自动重定向到登录页面(因为personalArea是一个安全的动作)。 我想要的是:登录后用户自动重定向(继续操作)到personalArea而不是主页。 所以,我想要的是:当用户因安全动作登录系统时,登录后执行动作(安全)继续。 我怎样才能做到这一点?

使用RestTemplate进行Spring安全身份validation

我有2个春季网络应用程序,提供2组独立的服务。 Web App 1使用基于用户的身份validation实现Spring Security。 现在,Web App 2需要访问Web App 1的服务。通常,我们将使用RestTemplate类向其他Web服务发出请求。 我们如何将Web App 2请求中的身份validation凭据传递给Web App 1

使用AuthenticationFailureHandler在Spring Security中自定义身份validation失败响应

目前,每当用户validation失败时,Spring安全性响应: {“error”: “invalid_grant”,”error_description”: “Bad credentials”} 我想通过以下响应代码来增强此响应: {“responsecode”: “XYZ”,”error”: “invalid_grant”,”error_description”: “Bad credentials”} 经过一番探讨,看起来我需要做的就是实现一个AuthenticationFailureHandler,我已经开始做了。 但是,每当我提交无效的登录凭据时,似乎都无法访问onAuthenticationFailure方法。 我已经逐步完成了代码,并在onAuthenticationFailure方法中进行了登录,以确认它未被访问。 我的失败处理程序是: @Component public class SSOAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler{ @Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { super.onAuthenticationFailure(request, response, exception); response.addHeader(“responsecode”, “XYZ”); } } 我的WebSecurityConfigurerAdapter包含: @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired SSOAuthenticationFailureHandler authenticationFailureHandler; @Override protected […]

Spring中的Websocket身份validation和授权

我一直在努力用Spring-Security正确实现Stomp(websocket) 身份validation和授权 。 对于后代,我会回答我自己的问题,提供指导。 问题 Spring WebSocket文档(用于身份validation)看起来不清楚ATM(恕我直言)。 我无法理解如何正确处理身份validation和授权 。 我想要的是 使用登录名/密码validation用户。 防止匿名用户通过WebSocket进行连接。 添加授权层(用户,管理员,…)。 Principal可以在控制器中使用。 我不想要的 在HTTP协商端点上进行身份validation(因为大多数JavaScript库不会与HTTP协商调用一起发送身份validation标头)。

JDBC中缺少dll

我目前正在使用Java中的SQL。 最近我收到了这个错误: com.microsoft.sqlserver.jdbc.AuthenticationJNI WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path 当我添加参数integratedSecurity=true;时会发生这种情况integratedSecurity=true; 在连接字符串中。 错误消息清楚地表明缺少sqljdbc_auth.dll,所以我尝试将dll放在与保留sqljdbc4.jar相同的路径中。 但是,这不起作用,所以我想知道我实际上如何将这个dll添加到我的构建路径? 有没有特殊的方法呢?