Examples of WebAuthenticationDetails


Examples of org.beangle.security.web.auth.WebAuthenticationDetails

    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (null == auth) return;
    log.setOperater(auth.getName());
    Object details = auth.getDetails();
    if ((details instanceof WebAuthenticationDetails)) {
      WebAuthenticationDetails webDetails = (WebAuthenticationDetails) details;
      log.setIp(webDetails.getAgent().getIp());
      log.setAgent(webDetails.getAgent().toString());
      log.setEntry(sessionRegistry.getResource(webDetails.getSessionId()));
    }
    entityDao.saveOrUpdate(log);
  }
View Full Code Here

Examples of org.beangle.security.web.auth.WebAuthenticationDetails

    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (null == auth) return;
    log.setOperator(auth.getName());
    Object details = auth.getDetails();
    if ((details instanceof WebAuthenticationDetails)) {
      WebAuthenticationDetails webDetails = (WebAuthenticationDetails) details;
      log.setIp(webDetails.getAgent().getIp());
      log.setAgent(webDetails.getAgent().getOs() + " " + webDetails.getAgent().getBrowser());
      log.setEntry(sessionRegistry.getResource(webDetails.getSessionId()));
    }
    if (null != event.getDetail()) {
      log.setDetail(new BusinessLogDetailBean(log, event.getDetail()));
    }
    entityDao.saveOrUpdate(log);
View Full Code Here

Examples of org.springframework.security.ui.WebAuthenticationDetails

   * @see org.saiku.web.service.ISessionService#authenticate(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
   */
  public void authenticate(HttpServletRequest req, String username, String password) {
    try {
      UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
      token.setDetails(new WebAuthenticationDetails(req));
      Authentication authentication = this.authenticationManager.authenticate(token);
      log.debug("Logging in with [{}]", authentication.getPrincipal());
      SecurityContextHolder.getContext().setAuthentication(authentication);
    }
    catch (BadCredentialsException bd) {
View Full Code Here

Examples of org.springframework.security.ui.WebAuthenticationDetails

   * @see org.saiku.web.service.ISessionService#authenticate(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
   */
  public void authenticate(HttpServletRequest req, String username, String password) {
    try {
      UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
      token.setDetails(new WebAuthenticationDetails(req));
      Authentication authentication = this.authenticationManager.authenticate(token);
      log.debug("Logging in with [{}]", authentication.getPrincipal());
      SecurityContextHolder.getContext().setAuthentication(authentication);
    }
    catch (BadCredentialsException bd) {
View Full Code Here

Examples of org.springframework.security.ui.WebAuthenticationDetails

      password = Encr.decryptPasswordOptionallyEncrypted( password );

      if ( ( existingAuth == null ) || !existingAuth.getName().equals( username ) || !existingAuth.isAuthenticated() ) {
        UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken( username, password );
        authRequest.setDetails( new WebAuthenticationDetails( httpRequest ) );

        Authentication authResult;

        try {
          authResult = authenticationManager.authenticate( authRequest );
View Full Code Here

Examples of org.springframework.security.ui.WebAuthenticationDetails

    request.addParameter( "userid", "admin" );
    request.addParameter( "password", "Encrypted 2be98afc86aa7f2e4bb18bd63c99dbdde" );

    filter.doFilter( request, new MockHttpServletResponse(), new MockFilterChain() );
    UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken( "admin", "password" );
    authRequest.setDetails( new WebAuthenticationDetails( request ) );
    verify( authManagerMock ).authenticate( Mockito.eq( authRequest ) );

  }
View Full Code Here

Examples of org.springframework.security.ui.WebAuthenticationDetails

    request.addParameter( "userid", "admin" );
    request.addParameter( "password", "password" );

    filter.doFilter( request, new MockHttpServletResponse(), new MockFilterChain() );
    UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken( "admin", "password" );
    authRequest.setDetails( new WebAuthenticationDetails( request ) );
    verify( authManagerMock ).authenticate( Mockito.eq( authRequest ) );

  }
View Full Code Here

Examples of org.springframework.security.web.authentication.WebAuthenticationDetails

            for (String key : data.keySet()) {
                Object object = data.get(key);

                // Extract the data that will be saved.
                if (object instanceof WebAuthenticationDetails) {
                    WebAuthenticationDetails authenticationDetails = (WebAuthenticationDetails) object;
                    results.put("remoteAddress", authenticationDetails.getRemoteAddress());
                    results.put("sessionId", authenticationDetails.getSessionId());
                } else {
                    results.put(key, object.toString());
                }
            }
        }
View Full Code Here

Examples of org.springframework.security.web.authentication.WebAuthenticationDetails

        cap.setServiceProperties(serviceProperties);
        cap.afterPropertiesSet();
        result = cap.authenticate(token);
        verify(validator,times(2)).validate(ticket, serviceUrl);

        token.setDetails(new WebAuthenticationDetails(new MockHttpServletRequest()));
        try {
            cap.authenticate(token);
            fail("Expected Exception");
        }catch(IllegalStateException success) {}
View Full Code Here

Examples of org.springframework.security.web.authentication.WebAuthenticationDetails

    @Before
    public void setUp() throws Exception {
        SecurityContextHolder.clearContext();
        UsernamePasswordAuthenticationToken rodRequest = new UsernamePasswordAuthenticationToken("rod", "koala");
        rodRequest.setDetails(new WebAuthenticationDetails(new MockHttpServletRequest()));
        Authentication rod =
            new UsernamePasswordAuthenticationToken("rod", "koala", AuthorityUtils.createAuthorityList("ROLE_1"));

        manager = mock(AuthenticationManager.class);
        when(manager.authenticate(rodRequest)).thenReturn(rod);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.