Package org.structr.core.auth

Examples of org.structr.core.auth.Authenticator


  @Override
  protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws UnsupportedEncodingException {

    SecurityContext securityContext = null;
    Authenticator authenticator = null;
    Result result = null;
    Resource resource = null;

    try {

      // isolate request authentication in a transaction
      try (final Tx tx = StructrApp.getInstance().tx()) {
        authenticator = config.getAuthenticator();
        securityContext = authenticator.initializeAndExamineRequest(request, response);
        tx.success();
      }
      final App app = StructrApp.getInstance(securityContext);

//                      logRequest("GET", request);
      request.setCharacterEncoding("UTF-8");
      response.setCharacterEncoding("UTF-8");
      response.setContentType("text/csv; charset=utf-8");

      // set default value for property view
      propertyView.set(securityContext, defaultPropertyView);

      // evaluate constraints and measure query time
      double queryTimeStart = System.nanoTime();

      // isolate resource authentication
      try (final Tx tx = app.tx()) {

        resource = ResourceHelper.optimizeNestedResourceChain(ResourceHelper.parsePath(securityContext, request, resourceMap, propertyView, defaultIdProperty), defaultIdProperty);
        authenticator.checkResourceAccess(request, resource.getResourceSignature(), propertyView.get(securityContext));

        tx.success();
      }

      try (final Tx tx = app.tx()) {

        String resourceSignature = resource.getResourceSignature();

        // let authenticator examine request again
        authenticator.checkResourceAccess(request, resourceSignature, propertyView.get(securityContext));

        // add sorting & paging
        String pageSizeParameter = request.getParameter(JsonRestServlet.REQUEST_PARAMETER_PAGE_SIZE);
        String pageParameter = request.getParameter(JsonRestServlet.REQUEST_PARAMETER_PAGE_NUMBER);
        String offsetId = request.getParameter(JsonRestServlet.REQUEST_PARAMETER_OFFSET_ID);
View Full Code Here


        existingUser = true;


      } else {

        Authenticator auth = securityContext.getAuthenticator();
        user = createUser(securityContext, User.eMail, emailString, propertySet, auth.getUserAutoCreate(), auth.getUserClass());
      }

      if (user != null) {

        if (!sendInvitationLink(user, propertySet)) {
View Full Code Here

    if ((username != null) && (password != null)) {

      try {

        StructrWebSocket socket = this.getWebSocket();
        Authenticator auth = socket.getAuthenticator();

        user = auth.doLogin(socket.getRequest(), username, password);

        if (user != null) {

          final String sessionId = webSocketData.getSessionId();
          if (sessionId == null) {
View Full Code Here

TOP

Related Classes of org.structr.core.auth.Authenticator

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.