Package javax.security.auth.message

Examples of javax.security.auth.message.AuthException


            try {
                response.setHeader("Location", response.encodeRedirectURL(request.getContextPath() + this.loginURI));
                response.setStatus(HttpServletResponse.SC_TEMPORARY_REDIRECT);
                //    rd.forward(request, response);
            } catch (Exception ex) {
                AuthException ae = new AuthException();
                ae.initCause(ex);
                throw ae;
            }
            return AuthStatus.SEND_CONTINUE;
        }


        // Check to see if successfull
        try {
            cbh.setRequest(request);
            lc.login();
            LOGGER.fine("Traitement du formulaire d'authentification");
            clientSubject = lc.getSubject();
            setCallerPrincipal(clientSubject);

            // recreate the session
            Map<String, Object> map = new HashMap<String, Object>();
            Enumeration<String> names = session.getAttributeNames();
            while (names.hasMoreElements()) {
                String key = names.nextElement();
                map.put(key, session.getAttribute(key));
            }
            session.invalidate();
            session = request.getSession(true);
            for (Entry<String, Object> key : map.entrySet()) {
                session.setAttribute(key.getKey().toString(), key.getValue());
            }

            // Save the Subject...
            session.setAttribute(SAVED_SUBJECT, clientSubject);

            // Save the userName
            session.setAttribute(USER_NAME, username);

            try {
                // Redirect...
                if (getSavedRequestURL(session) != null) {
                    response.sendRedirect(response.encodeRedirectURL(getSavedRequestURL(session)));
                } else if (backward != null) {
                    response.sendRedirect(response.encodeRedirectURL(backward));
                } else {
                    response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/"));
                }
            } catch (Exception ex) {
                AuthException ae = new AuthException();
                ae.initCause(ex);
                throw ae;
            }

            /*
             * if ((new Date().getTime() - ((EvasionPrincipal)
             * userPrincipal).getLastLogin().getTime()) > 86400) {
             * UserTransaction tx = ejbClient.getTransaction(); if (tx != null)
             * { LOGGER.log(Level.FINE, "UserTransaction status
             * {0}",tx.getStatus()); tx.begin(); try {
             * loginEJB.postLogin(userPrincipal.getName()); } finally {
             * tx.commit(); tx = null; } } }
             */
            saveLoginBackToURL(request, session);

            // Continue...
            return AuthStatus.SEND_CONTINUE;

        } catch (LoginException le) {
            LOGGER.log(Level.SEVERE, "ERROR SAM!!!", le);
            RequestDispatcher rd = request.getRequestDispatcher(this.loginURI);
            try {
                rd.forward(request, response);
            } catch (Exception ex) {
                AuthException ae = new AuthException();
                ae.initCause(ex);
                throw ae;
            }
            return AuthStatus.SEND_FAILURE;
        } catch (Exception ex) {
            LOGGER.log(Level.SEVERE, "ERROR SAM!!!", ex);
View Full Code Here


                        assignedGroups)} : new Callback[]{callerPrincipalCallback}));

            LOGGER.log(Level.FINE, "jmac.caller_principal:{0} {1}", new Object[]{callerPrincipalCallback.getName(), callerPrincipalCallback.getPrincipal()});
        } catch (Exception ex) {
            LOGGER.log(Level.SEVERE, "ERROR SAM!!!", ex);
            AuthException ae = new AuthException();
            ae.initCause(ex);
            throw ae;
        }
    }
View Full Code Here

        subject.getPublicCredentials().clear();

        try {
            lc.logout();
        } catch (LoginException ex) {
            AuthException ae = new AuthException();
            ae.initCause(ex);
            throw ae;
        }
    }
View Full Code Here

                    logger.log(Level.WARNING,
                        "jmac.provider_unable_to_load_authmodule",
                        new String [] { moduleClassName, e.toString() });
                }

                AuthException ae = new AuthException();
                ae.initCause(e);
                throw ae;
            }
        }
View Full Code Here

      } else if (GFServerConfigProvider.SOAP.equals(layer)) {
                if (wsdelegate != null) {
                    return wsdelegate.newSOAPAuthParam(info);
                }
      }
      throw new AuthException("unsupported AuthParam type");
  }
View Full Code Here

    }

    try {
        handler.handle(callbacks);
    } catch (Exception e) {
        AuthException aex = new AuthException();
                    aex.initCause(e);
                    throw aex;
    }
            }
  }
View Full Code Here

        return null;
                            }
                        });
                } catch(PrivilegedActionException pae) {
                    Throwable cause = pae.getCause();
                    AuthException aex = new AuthException();
                    aex.initCause(cause);
                    throw aex;
                }
            }
  }
View Full Code Here

                oldModule.secureResponse(config.getAuthParam(messageInfo),
                        serviceSubject,
                        messageInfo.getMap());
                return AuthStatus.SEND_SUCCESS;
            } else {
                throw new AuthException();
            }
        }
View Full Code Here

            if (module != null) {
                module.cleanSubject(messageInfo, subject);
            } else if (oldModule != null) {
                oldModule.disposeSubject(subject, messageInfo.getMap());
            } else {
                 throw new AuthException();
            }
        }
View Full Code Here

    oldModule.secureRequest(config.getAuthParam(messageInfo),
          clientSubject,
          messageInfo.getMap());
    return AuthStatus.SEND_SUCCESS;
            } else {
                throw new AuthException();
            }
        }
View Full Code Here

TOP

Related Classes of javax.security.auth.message.AuthException

Copyright © 2018 www.massapicom. 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.