当前位置: 首页>>代码示例>>Java>>正文


Java Security.Authenticated方法代码示例

本文整理汇总了Java中play.mvc.Security.Authenticated方法的典型用法代码示例。如果您正苦于以下问题:Java Security.Authenticated方法的具体用法?Java Security.Authenticated怎么用?Java Security.Authenticated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在play.mvc.Security的用法示例。


在下文中一共展示了Security.Authenticated方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: flowLineage

import play.mvc.Security; //导入方法依赖的package包/类
@Security.Authenticated(Secured.class)
public static Result flowLineage(String application, String project, String flow)
{
    String username = session("user");
    if (username == null)
    {
        username = "";
    }
    String type = "azkaban";
    if (StringUtils.isNotBlank(application) && (application.toLowerCase().indexOf("appworx") != -1))
    {
        type = "appworx";

    }
    return ok(lineage.render(username, type, 0, application.replace(" ", "."), project, flow));
}
 
开发者ID:SirAeroWN,项目名称:premier-wherehows,代码行数:17,代码来源:Application.java

示例2: loadTree

import play.mvc.Security; //导入方法依赖的package包/类
@Security.Authenticated(Secured.class)
public static Result loadTree(String key)
{
    if (StringUtils.isNotBlank(key) && key.equalsIgnoreCase("flows")) {
        return ok(FlowsDAO.getFlowApplicationNodes());
    }
    // switch here..
    boolean isFiltered = false;
    if (isFiltered) {
        if (StringUtils.isNotBlank(key)) {
            String username = session("user");
            if (username != null) {
                String treeName = Play.application().configuration().getString(key + TREE_NAME_SUBFIX);
                return ok(UserDAO.getUserGroupFileTree(username, treeName));
            }
        }
        return ok(Json.toJson(""));
    } else {
        return ok(Tree.loadTreeJsonNode(key + TREE_NAME_SUBFIX));
    }
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:22,代码来源:Application.java

示例3: getUserInfo

import play.mvc.Security; //导入方法依赖的package包/类
@Security.Authenticated(AuthService.class)
public static Result getUserInfo() {
    UserModel model = userParser.parseUser(request());
    JsonObject result = new JsonObject();
    if (model != null) {
        model = UserDao.getInstance().getUserInfo(model.getEmail());
        if (model != null) {
            result.add(ResponseConstant.PARAMS_RESPONSE_DATA, model.toJson());
            result.add(ResponseConstant.PARAMS_RESPONSE_CODE, ResponseConstant.RESPONSE_CODE_SUCCESS);
            result.add(ResponseConstant.PARAMS_RESPONSE_MESSAGE, "User found");
        } else {
            result.add(ResponseConstant.PARAMS_RESPONSE_CODE, ResponseConstant.RESPONSE_CODE_FAILED);
            result.add(ResponseConstant.PARAMS_RESPONSE_MESSAGE, "No user found with " + model.getEmail());
        }
    } else {
        result.add(ResponseConstant.PARAMS_RESPONSE_CODE, ResponseConstant.RESPONSE_CODE_FAILED);
        result.add(ResponseConstant.PARAMS_RESPONSE_MESSAGE, "Email and password required");
    }

    return ok(result.toString());
}
 
开发者ID:shuza,项目名称:Simple-RestFull-API,代码行数:22,代码来源:UserController.java

示例4: setUserDefinedName

import play.mvc.Security; //导入方法依赖的package包/类
@Security.Authenticated(UserAuthenticator.class)
public Result setUserDefinedName() {
    long userId = getUserIdForRequest();

    JsonNode jsonRequest = request().body().asJson();

    long deviceId = -1L;

    try {
        deviceId = getDeviceId(userId, jsonRequest);
    } catch (APIErrorException e) {
        return badRequestJson(e.getError());
    }

    String userDefinedName = jsonRequest.path("user_defined_name").asText();

    if (userDefinedName.length() > 30) {
        userDefinedName = userDefinedName.substring(0, 30);
    }

    if (!DevicePersistency.setUserDefinedName(deviceId, userDefinedName)) {
        return internalServerErrorJson(AssistanceAPIErrors.unknownInternalServerError);
    }

    return ok();
}
 
开发者ID:Telecooperation,项目名称:assistance-platform-server,代码行数:27,代码来源:DevicesController.java

示例5: customPost

import play.mvc.Security; //导入方法依赖的package包/类
@Security.Authenticated(UserAuthenticator.class)
public Promise<Result> customPost(String moduleId, String path) {
    return custom(moduleId, path, (r) -> {
        RequestBody body = request().body();

        String postBody = null;

        if (body.asText() != null) {
            postBody = body.asText();
        } else if (body.asJson() != null) {
            r.setContentType("application/json");
            postBody = body.asJson().toString();
        } else if (body.asXml() != null) {
            r.setContentType("application/xml");
            postBody = body.asXml().toString();
        }

        return r.post(postBody);
    });
}
 
开发者ID:Telecooperation,项目名称:assistance-platform-server,代码行数:21,代码来源:CustomAssistanceProxy.java

示例6: list

import play.mvc.Security; //导入方法依赖的package包/类
@Security.Authenticated(UserAuthenticator.class)
public Result list(String language) {

    JsonNode result = Cache
            .getOrElse(
                    "moduleList" + language,
                    () -> {
                        ActiveAssistanceModule[] assiModules = ActiveAssistanceModulePersistency
                                .list(language);

                        JsonNode json = Json.toJson(assiModules);
                        return json;
                    }, 3600);

    return ok(result);
}
 
开发者ID:Telecooperation,项目名称:assistance-platform-server,代码行数:17,代码来源:AssistanceController.java

示例7: upload

import play.mvc.Security; //导入方法依赖的package包/类
@Security.Authenticated(UserAuthenticator.class)
public Result upload() {
    long start = System.currentTimeMillis();
    JsonNode postData = request().body().asJson();

    APIError result = handleSensorData(postData, getUserIdForRequest());

    if (result != null) {
        return badRequestJson(result);
    }

    long processingTime = System.currentTimeMillis() - start;

    Map<String, Object> r = new HashMap<>();
    r.put("processingTime", processingTime);

    return ok(r);
}
 
开发者ID:Telecooperation,项目名称:assistance-platform-server,代码行数:19,代码来源:SensorDataController.java

示例8: editSet

import play.mvc.Security; //导入方法依赖的package包/类
/**
 * Renders the editSet page with a form to add a new Set if the ID is 0.  Otherwise, update an existing
 * Set based on the passed in ID number.
 *
 * @param id The ID of the Set to edit (or 0 if it's a new routine).
 * @return An HTTP OK message along with the HTML content for the EditSet page.
 */
@Security.Authenticated(Secured.class)
public static Result editSet(long id) {
  SetFormData setFormData = (id == 0) ? new SetFormData() : new SetFormData(Set.getSet(id));

  Form<SetFormData> formData = Form.form(SetFormData.class).fill(setFormData);

  if (id != 0) {
    Set thisSet = Set.getSet(id);
    return ok(EditSet.render("editSet", Secured.isLoggedIn(ctx()), Secured.getUserInfo(ctx()), formData,
        Routine.getActiveRoutines(), Routine.getListOfIds(thisSet.getRoutines())));
  }
  else {
    List<Long> emptyListOfRoutinesInSet = new ArrayList<Long>();

    return ok(EditSet.render("editSet", Secured.isLoggedIn(ctx()), Secured.getUserInfo(ctx()), formData,
        Routine.getActiveRoutines(), emptyListOfRoutinesInSet));
  }
}
 
开发者ID:PlayWithMagic,项目名称:PlayWithMagic.org,代码行数:26,代码来源:Application.java

示例9: editMaterial

import play.mvc.Security; //导入方法依赖的package包/类
/**
 * Show the EditMaterial page to update an item.  First, process the Routine page, deal with any errors and update
 * the database.  Finally, show the EditMaterial page.
 *
 * @param materialId The ID of the Material you want to edit.
 * @return An HTTP page EditMaterial if all is well or EditRoutine if there's an error on that page.
 */
@Security.Authenticated(Secured.class)
public static Result editMaterial(Long materialId) {
  Form<RoutineFormData> formWithRoutineData = Form.form(RoutineFormData.class).bindFromRequest();

  Logger.debug("editMaterial Raw Routine Form Data");
  Logger.debug("  routineId = [" + formWithRoutineData.field("id").value() + "]");
  Logger.debug("  name = [" + formWithRoutineData.field("name").value() + "]");
  Logger.debug("  materialID = [" + materialId + "]");

  long routineId = new Long(formWithRoutineData.field("id").value()).longValue();

  if (formWithRoutineData.hasErrors()) {
    Logger.error("HTTP Form Error in editMaterial");

    return badRequest(EditRoutine.render("editRoutine", Secured.isLoggedIn(ctx()), Secured.getUserInfo(ctx()),
        formWithRoutineData, Routine.getMaterials(routineId)));
  }

  RoutineFormData data = formWithRoutineData.get();
  Routine routine = Routine.saveRoutineFromForm(data);
  routineId = routine.getId();

  return editMaterialDirect(materialId);
}
 
开发者ID:PlayWithMagic,项目名称:PlayWithMagic.org,代码行数:32,代码来源:Application.java

示例10: deleteMaterial

import play.mvc.Security; //导入方法依赖的package包/类
/**
 * Delete a Material item and redisplay the EditRoutine page.  First, process the Routine page and deal with any
 * errors.  Update the database, then delete the Material item and finally redisplay EditRoutine.
 *
 * @param materialId The ID of the Material to delete.
 * @return An HTTP EditMaterial page.
 */
@Security.Authenticated(Secured.class)
public static Result deleteMaterial(Long materialId) {
  Form<RoutineFormData> formWithRoutineData = Form.form(RoutineFormData.class).bindFromRequest();
  long routineId = new Long(formWithRoutineData.field("id").value()).longValue();

  if (formWithRoutineData.hasErrors()) {
    Logger.error("HTTP Form Error in deleteMaterial");

    return badRequest(EditRoutine.render("editRoutine", Secured.isLoggedIn(ctx()), Secured.getUserInfo(ctx()),
        formWithRoutineData, Routine.getMaterials(routineId)));
  }

  RoutineFormData routineFormData = formWithRoutineData.get();
  Routine routine = Routine.saveRoutineFromForm(routineFormData);
  routineId = routine.getId();

  // End of processing Routine page.  Start of processing material.

  Material.getMaterial(materialId).delete();

  return ok(EditRoutine.render("editRoutine", Secured.isLoggedIn(ctx()), Secured.getUserInfo(ctx()),
      formWithRoutineData, Routine.getMaterials(routineId)));
}
 
开发者ID:PlayWithMagic,项目名称:PlayWithMagic.org,代码行数:31,代码来源:Application.java

示例11: addPotentialParticipant

import play.mvc.Security; //导入方法依赖的package包/类
/**
    * Allows to add a participant to the potential participants List for a selected workshop
    * 
    * @param id workshop id
    * @return the welcome page
    */
   @Transactional
   @Security.Authenticated(Secured.class)
   public static Result addPotentialParticipant( Long id ) {
   	// We get the Workshop
       Workshop	currentWorkshop 	= 	Workshop.find.byId(id);
       
       // Get the connected User
       User		user				=	Secured.getUser();
       
       // It's a Set, so no duplicate
       currentWorkshop.potentialParticipants.add( user );
       
       // We save the new Workshop
       Ebean.save(currentWorkshop);
   	
       return redirect(routes.Application.newWorkshops() + "#" + id);
}
 
开发者ID:sqlilabs,项目名称:WorkshopManager,代码行数:24,代码来源:WorkshopController.java

示例12: view

import play.mvc.Security; //导入方法依赖的package包/类
@Security.Authenticated(SecuredController.class)
  public static Result view(Long id) {
  	License license = License.findById(id);
Logger.info("License: "+license);
  	if (license != null) {
  		if (request().accepts("text/html")) {
  			User user = User.findByEmail(request().username());
  			CrawlPermission cp = new CrawlPermission();
  			cp.contactPerson = new ContactPerson();
  			cp.setLicense(license);
  			cp.target = new Target();
  			return ok(ukwalicence.render(cp, false));
  		} else {
  			return ok(Json.toJson(license));
  		}
  	} else {
  		return notFound("There is no License with ID "+id);
  	}
  }
 
开发者ID:ukwa,项目名称:w3act,代码行数:20,代码来源:LicenseController.java

示例13: addWorkshopRessources

import play.mvc.Security; //导入方法依赖的package包/类
/**
    * Prepare the form to add resources
    * 
 * @param id the workshop ID
 * @return the resources form view
 */
   @Transactional
   @Security.Authenticated(Secured.class)
   public static Result addWorkshopRessources(Long id) {
   	Workshop 	ws 			= 	Workshop.find.byId(id);

       if (!Secured.isMemberOf(Roles.ADMIN) && !UsersUtils.isWorkshopAuthor(ws) && !UsersUtils.isOneWorkshopSpeaker(ws)) {
           return forbidden();
       }

   	Ressources 	ressources	=	ws.workshopRessources;
   	
   	// if we already set resources, we want to fill the form with our old data
   	Form<Ressources> resourcesForm = null;
   	if ( ressources != null ) {
   		resourcesForm 		= 	play.data.Form.form(Ressources.class).fill(ressources);
   	}
   	else {
   		resourcesForm 		= 	play.data.Form.form(Ressources.class);
   	}

	return ok( addRessources.render(resourcesForm, id) );
}
 
开发者ID:sqlilabs,项目名称:WorkshopManager,代码行数:29,代码来源:WorkshopController.java

示例14: removeSpeaker

import play.mvc.Security; //导入方法依赖的package包/类
/**
 * Allows to remove a proposal Speaker to the speaker List for a selected workshop
 * 
 * @param id workshop id
 * @return the welcome page
 */
@Transactional
@Security.Authenticated(Secured.class)
public static Result removeSpeaker( Long id ) {
	// We get the Workshop
    Workshop	currentWorkshop 	= 	Workshop.find.byId(id);
    
    // Get the connected User
    User		user				=	Secured.getUser();
    
    // It's a Set, so no duplicate
    currentWorkshop.speakers.remove( user );
    
    // We save the new Workshop
    Ebean.save(currentWorkshop);
	
    return redirect(routes.Application.newWorkshops() + "#" + id);
}
 
开发者ID:sqlilabs,项目名称:WorkshopManager,代码行数:24,代码来源:WorkshopController.java

示例15: removePotentialParticipant

import play.mvc.Security; //导入方法依赖的package包/类
/**
 * Allows to remove a participant to the potential participants List for a selected workshop
 * 
 * @param id workshop id
 * @return the welcome page
 */
@Transactional
@Security.Authenticated(Secured.class)
public static Result removePotentialParticipant( Long id ) {
	// We get the Workshop
    Workshop	currentWorkshop 	= 	Workshop.find.byId(id);
    
    // Get the connected User
    User		user				=	Secured.getUser();
    
    // It's a Set, so no duplicate
    currentWorkshop.potentialParticipants.remove( user );
    
    // We save the new Workshop
    Ebean.save(currentWorkshop);
	
    return redirect(routes.Application.newWorkshops() + "#" + id);
}
 
开发者ID:sqlilabs,项目名称:WorkshopManager,代码行数:24,代码来源:WorkshopController.java


注:本文中的play.mvc.Security.Authenticated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。