index
int64
repo_id
string
file_path
string
content
string
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/client/FusionBrainClientImpl.java
package ai.fusionbrain.client; import ai.fusionbrain.config.FusionBrainProperties; import ai.fusionbrain.dto.*; import ai.fusionbrain.dto.request.PipelineParams; import ai.fusionbrain.exception.FusionBrainException; import ai.fusionbrain.exception.FusionBrainServerException; import ai.fusionbrain.exception.PipelineDisabledException; import ai.fusionbrain.exception.ValidationException; import ai.fusionbrain.utils.ValidationUtil; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.util.List; import java.util.Objects; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @Slf4j @Component @RequiredArgsConstructor public class FusionBrainClientImpl implements FusionBrainClient { private final FusionBrainFeignClient feignClient; private final ObjectMapper objectMapper; private final FusionBrainProperties fusionBrainProperties; private final Executor asyncExecutor; @Override public List<PipelineDTO> getPipelines() throws FusionBrainException { log.debug("Fetching all pipelines"); try { List<PipelineDTO> pipelines = feignClient.getPipelines(null); log.debug("Successfully fetched {} pipelines", pipelines.size()); log.trace("Pipeline details: {}", pipelines); return pipelines; } catch (FusionBrainServerException e) { log.error("Feign client error while getting pipelines", e); throw e; } catch (Exception e) { log.error("Failed to get pipelines", e); throw new FusionBrainException("Failed to get pipelines", e); } } @Override public List<PipelineDTO> getPipelines(EPipelineType type) throws FusionBrainException { log.debug("Fetching pipelines of type: {}", type); try { List<PipelineDTO> pipelines = feignClient.getPipelines(type); log.debug("Found {} pipelines of type {}", pipelines.size(), type); log.trace("Pipeline details for type {}: {}", type, pipelines); return pipelines; } catch (FusionBrainServerException e) { log.error("Feign client error while getting pipelines", e); throw e; } catch (Exception e) { log.error("Failed to get pipelines", e); throw new FusionBrainException("Failed to get pipelines", e); } } @Override public AvailabilityStatus getPipelineAvailability(UUID pipelineId) throws FusionBrainException { log.debug("Checking availability for pipeline: {}", pipelineId); try { AvailabilityStatus status = feignClient.getPipelineAvailability(pipelineId); log.debug("Pipeline {} availability status: {}", pipelineId, status); return status; } catch (FusionBrainServerException e) { log.error("Feign client error while checking pipeline {} availability: {}", pipelineId, e.getMessage()); throw e; } catch (Exception e) { log.error("Failed to check availability for pipeline {}: {}", pipelineId, e.getMessage()); throw new FusionBrainException("Failed to get pipeline availability", e); } } @Override public RunResponse runPipeline(UUID pipelineId, PipelineParams params, List<byte[]> files) throws FusionBrainException { log.debug("Starting pipeline execution for pipeline: {}", pipelineId); log.trace("Pipeline parameters: {}", params); log.trace("Files count: {}", files != null ? files.size() : 0); try { if (Objects.nonNull(params)) { ValidationUtil.validate(params); } log.debug("Pipeline parameters validation successful"); if (files != null) { files.forEach(file -> { if (file == null || file.length == 0) { log.error("Validation failed: File content is null or empty"); throw new ValidationException("File content cannot be null or empty"); } }); log.debug("All {} files passed validation", files.size()); } var paramsNode = objectMapper.valueToTree(params); log.trace("Converted params to JSON node: {}", paramsNode); var response = feignClient.runPipeline(paramsNode, pipelineId, files); log.debug("Pipeline execution started successfully for pipeline: {}", pipelineId); log.trace("Initial response: {}", response); if (Objects.nonNull(response.getModelStatus()) && response.getModelStatus().isDisabled()) { log.debug("Attempted to use disabled model in pipeline: {}", pipelineId); throw new PipelineDisabledException("Pipeline is currently disabled and cannot process requests"); } return response; } catch (ValidationException e) { log.error("Validation failed for pipeline parameters: {}", e.getMessage()); throw e; } catch (PipelineDisabledException e) { log.error("Pipeline disabled error: {}", e.getMessage()); throw e; } catch (FusionBrainServerException e) { log.error("Feign client error while executing pipeline {}: {}", pipelineId, e.getMessage()); throw e; } catch (Exception e) { log.error("Failed to run pipeline {}: {}", pipelineId, e.getMessage()); throw new FusionBrainException("Failed to run pipeline", e); } } @Override public StatusResponse getStatus(UUID taskId) throws FusionBrainException { log.debug("Fetching status for task: {}", taskId); try { StatusResponse status = feignClient.getStatus(taskId); log.debug("Task {} status: {}", taskId, status.getStatus()); log.trace("Full status response: {}", status); return status; } catch (FusionBrainServerException e) { log.error("Feign client error while getting status for task {}: {}", taskId, e.getMessage()); throw e; } catch (Exception e) { log.error("Failed to get status for task {}: {}", taskId, e.getMessage()); throw new FusionBrainException("Failed to get task status", e); } } @Override public CompletableFuture<StatusResponse> waitForCompletion(UUID taskId, long initialDelay) { CompletableFuture<StatusResponse> future = new CompletableFuture<>(); asyncExecutor.execute(() -> { try { StatusResponse result = waitForCompletionInternal(taskId, initialDelay); future.complete(result); } catch (Exception e) { future.completeExceptionally(e); } }); return future; } private StatusResponse waitForCompletionInternal(UUID taskId, long initialDelay) throws FusionBrainException { log.debug("Starting wait for task completion: {}", taskId); log.debug("Initial delay: {} seconds, max retries: {}, poll interval: {} seconds", initialDelay, fusionBrainProperties.getMaxRetries(), fusionBrainProperties.getPollInterval()); if (initialDelay < 0) { log.error("Invalid initial delay: {} seconds", initialDelay); throw new IllegalArgumentException("Initial delay cannot be negative"); } if (initialDelay > 0) { log.debug("Waiting initial delay of {} seconds", initialDelay); sleepInterruption(initialDelay * 1000L); } StatusResponse initialStatus = getStatus(taskId); log.debug("Initial status after delay: {}", initialStatus.getStatus()); if (initialStatus.getStatus().isFinal()) { log.debug("Task {} completed with initial delay", taskId); return initialStatus; } int retryCount = 0; while (retryCount < fusionBrainProperties.getMaxRetries()) { log.debug("Polling attempt {}/{} for task {}", retryCount + 1, fusionBrainProperties.getMaxRetries(), taskId); StatusResponse status = getStatus(taskId); log.trace("Current task status: {}", status); if (status.getStatus().isFinal()) { return status; } long nextPollDelay = fusionBrainProperties.getPollInterval() * 1000L; log.trace("Sleeping for {} ms before next poll", nextPollDelay); sleepInterruption(nextPollDelay); retryCount++; } log.error("Timeout waiting for task {} completion after {} attempts", taskId, fusionBrainProperties.getMaxRetries()); throw new FusionBrainException("Timeout waiting for task completion after " + fusionBrainProperties.getMaxRetries() + " attempts"); } private void sleepInterruption(long millis) throws FusionBrainException { try { Thread.sleep(millis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new FusionBrainException("Polling was interrupted", e); } } }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/client/FusionBrainFeignClient.java
package ai.fusionbrain.client; import ai.fusionbrain.config.FeignConfig; import ai.fusionbrain.dto.*; import com.fasterxml.jackson.databind.JsonNode; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.UUID; @FeignClient( name = "fusionBrainClient", url = "${fusionbrain.base-url}", path = "/key/api/v1", configuration = FeignConfig.class ) @ConditionalOnProperty(prefix = "fusionbrain", name = "enabled", havingValue = "true") public interface FusionBrainFeignClient { @GetMapping("/pipelines") List<PipelineDTO> getPipelines(@RequestParam(value = "type", required = false) EPipelineType type); @GetMapping("/pipeline/{pipeline_id}/availability") AvailabilityStatus getPipelineAvailability(@PathVariable("pipeline_id") UUID pipelineId); @PostMapping(value = "/pipeline/run", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) RunResponse runPipeline( @RequestPart(value = "params", required = false) JsonNode params, @RequestParam("pipeline_id") UUID pipelineId, @RequestPart(value = "file", required = false) List<byte[]> files ); @GetMapping("/pipeline/status/{uuid}") StatusResponse getStatus(@PathVariable UUID uuid); }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/config/FeignConfig.java
package ai.fusionbrain.config; import ai.fusionbrain.exception.FusionBrainErrorDecoder; import feign.Client; import feign.RequestInterceptor; import feign.codec.ErrorDecoder; import feign.httpclient.ApacheHttpClient; import lombok.RequiredArgsConstructor; import org.apache.http.impl.client.CloseableHttpClient; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration @RequiredArgsConstructor public class FeignConfig { private static final String KEY_HEADER = "X-Key"; private static final String KEY_PREFIX = "Key "; private static final String SECRET_HEADER = "X-Secret"; private static final String SECRET_PREFIX = "Secret "; private final FusionBrainProperties properties; @Bean public RequestInterceptor requestInterceptor() { return requestTemplate -> { requestTemplate.header(KEY_HEADER, KEY_PREFIX + properties.getApiKey()); requestTemplate.header(SECRET_HEADER, SECRET_PREFIX + properties.getApiSecret()); }; } @Bean public ErrorDecoder errorDecoder() { return new FusionBrainErrorDecoder(); } @Bean @ConditionalOnBean(CloseableHttpClient.class) public Client feignClient(CloseableHttpClient httpClient) { return new ApacheHttpClient(httpClient); } }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/config/FusionBrainProperties.java
package ai.fusionbrain.config; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.Positive; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; /** * Configuration properties for FusionBrain API integration. */ @Data @ConfigurationProperties(prefix = "fusionbrain") @Validated public class FusionBrainProperties { /** * Whether FusionBrain API integration is enabled. * <p>Default: true</p> */ private boolean enabled = true; /** * Base URL for the FusionBrain API. * <p>Defaults to {@code https://api-key.fusionbrain.ai}</p> */ @NotEmpty(message = "baseUrl must not be empty") private String baseUrl = "https://api-key.fusionbrain.ai"; /** * API key required for authenticating requests. * * @see #apiSecret */ @NotEmpty(message = "API key must not be empty") private String apiKey; /** * API secret required for authenticating requests. * * @see #apiKey */ @NotEmpty(message = "API secret must not be empty") private String apiSecret; /** * Maximum number of retries for failed requests. * <p>Default: 5</p> */ @Min(value = 0, message = "maxRetries must be at least 0.") private int maxRetries = 5; /** * Interval between polling attempts for asynchronous operations. * <p>Units: seconds</p> * <p>Default: 3</p> */ @Positive(message = "pollInterval must be positive") private long pollInterval = 3; /** * Maximum number of threads for asynchronous operations. * <p>Units: threads</p> * <p>Default: 1</p> */ @Positive(message = "asyncCorePoolSize must be positive") private int asyncCorePoolSize = 1; }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/config/FusionBrainSslProperties.java
package ai.fusionbrain.config; import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; @Getter @Setter @ConfigurationProperties(prefix = "fusionbrain.ssl") public class FusionBrainSslProperties { /** * Whether SSL certificate validation is enabled. * <p>Default: false</p> */ private boolean enabled = false; /** * Path to a truststore file (classpath: or file: prefix) */ private String truststore; /** * Truststore password */ private String truststorePassword; /** * Truststore type (JKS, PKCS12) */ private String truststoreType = "JKS"; }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/AvailabilityStatus.java
package ai.fusionbrain.dto; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** * DTO class representing the availability status of a pipeline. */ @Data @AllArgsConstructor @NoArgsConstructor public class AvailabilityStatus { /** * The current status of the pipeline. */ private EPipelineStatus status; }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/EPipelineStatus.java
package ai.fusionbrain.dto; public enum EPipelineStatus { ACTIVE, DISABLED_MANUALLY, DISABLED_BY_QUEUE; /** * Checks if the pipeline status is disabled. * * @return true if the status is either DISABLED_MANUALLY or DISABLED_BY_QUEUE, false otherwise. */ public boolean isDisabled() { return this.equals(DISABLED_MANUALLY) || this.equals(DISABLED_BY_QUEUE); } }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/EPipelineType.java
package ai.fusionbrain.dto; public enum EPipelineType { TEXT2IMAGE }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/EResourceStatus.java
package ai.fusionbrain.dto; /** * Enumeration representing the possible statuses of a resource. */ public enum EResourceStatus { /** * Initial status indicating that the resource has just been created and no processing has started yet. */ INITIAL, /** * Status indicating that the resource is currently being processed. */ PROCESSING, /** * Final status indicating that the resource processing has completed successfully. */ DONE, /** * Final status indicating that the resource processing has failed. */ FAIL, /** * Final status indicating that the user or system has canceled the resource processing. */ CANCEL; /** * Checks if the current status is a final status (i.e., not in progress). * * @return true if the status is DONE, FAIL, or CANCEL; false otherwise. */ public boolean isFinal() { return this.equals(DONE) || this.equals(FAIL) || this.equals(CANCEL); } }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/PipelineDTO.java
package ai.fusionbrain.dto; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.time.Instant; import java.util.Set; import java.util.UUID; /** * DTO representing a pipeline. */ @Data @AllArgsConstructor @NoArgsConstructor public class PipelineDTO { /** * Unique identifier of the pipeline. */ private UUID id; /** * Name of the pipeline in the default language. */ private String name; /** * Name of the pipeline in English. */ private String nameEn; /** * Description of the pipeline in the default language. */ private String description; /** * Description of the pipeline in English. */ private String descriptionEn; /** * Tags associated with this pipeline. */ private Set<TagDTO> tags; /** * Version number of the pipeline. */ private double version; /** * Current status of the pipeline. */ private EPipelineStatus status; /** * Type of the pipeline. */ private EPipelineType type; /** * Date when this pipeline was created. */ private Instant createdDate; /** * Last date when this pipeline was modified. */ private Instant lastModified; }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/RunResponse.java
package ai.fusionbrain.dto; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.UUID; /** * DTO class representing a response for a run operation. */ @Data @AllArgsConstructor @NoArgsConstructor @Builder @JsonInclude(JsonInclude.Include.NON_NULL) public class RunResponse { /** * Unique identifier for the run request. */ @JsonProperty("uuid") private UUID id; /** * The current status of the resource. */ private EResourceStatus status; /** * The pipeline status. This field is present only when the pipeline is unavailable. */ @JsonProperty("model_status") private EPipelineStatus modelStatus; /** * This value represents the number of seconds after which the status should be called. */ @JsonProperty("status_time") private long statusTime; }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/StatusResponse.java
package ai.fusionbrain.dto; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.UUID; /** * DTO class representing the response status of a request. */ @Data @AllArgsConstructor @NoArgsConstructor @Builder @JsonInclude(JsonInclude.Include.NON_NULL) public class StatusResponse { /** * Unique identifier associated with the request. */ @JsonProperty("uuid") private UUID id; /** * Current status of the request. */ private EResourceStatus status; /** * Description providing more details about the current status. */ private String statusDescription; /** * Result data associated with the request, represented as a JSON node. */ private JsonNode result; /** * Time taken (in seconds) to generate the resource. */ private Long generationTime; }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/TagDTO.java
package ai.fusionbrain.dto; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class TagDTO { @JsonProperty("name") private String name; @JsonProperty("name_en") private String nameEn; }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/request/EText2ImageType.java
package ai.fusionbrain.dto.request; /** * Enum representing the type of text-to-image operation. */ public enum EText2ImageType { GENERATE, }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/request/GenerateParams.java
package ai.fusionbrain.dto.request; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** * Generation parameters containing the text query. */ @Data @AllArgsConstructor @NoArgsConstructor public class GenerateParams { /** * The text query for image generation. * Must be between 1 and 1000 characters long. */ @NotBlank(message = "The query field is required.") @Size(min = 1, max = 1000, message = "The query field must be between 1 and 1000 characters long.") private String query; }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/request/PipelineParams.java
package ai.fusionbrain.dto.request; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = As.PROPERTY, property = "type" ) @JsonSubTypes({ @JsonSubTypes.Type(value = Text2ImageParams.class, name = "TEXT_TO_IMAGE"), }) public abstract class PipelineParams { }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/dto/request/Text2ImageParams.java
package ai.fusionbrain.dto.request; import jakarta.validation.Valid; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; /** * Parameters for text-to-image generation request. */ @Data @AllArgsConstructor @NoArgsConstructor @EqualsAndHashCode(callSuper = false) public class Text2ImageParams extends PipelineParams { /** * The type of text-to-image operation. */ @NotNull(message = "The 'params.type' field is required.") private EText2ImageType type = EText2ImageType.GENERATE; /** * Width of the generated image. * Must be between 128 and 2048 pixels. */ @NotNull(message = "The width field is required.") @Min(value = 128, message = "The width field must be at least 128.") @Max(value = 2048, message = "The width field must be at most 2048.") private Integer width = 1024; /** * Height of the generated image. * Must be between 128 and 2048 pixels. */ @NotNull(message = "The height field is required.") @Min(value = 128, message = "The height field must be at least 128.") @Max(value = 2048, message = "The height field must be at most 2048.") private Integer height = 1024; /** * Number of images to generate. */ @NotNull(message = "The numImages field is required.") @Min(value = 1, message = "The numImages field must be exactly 1.") @Max(value = 1, message = "The numImages field must be exactly 1.") private Integer numImages = 1; /** * Parameters for image generation. * Must contain a non-empty query string. */ @NotNull(message = "The generateParams object is required.") @Valid private GenerateParams generateParams; /** * Optional negative prompt for the decoder. * If provided, must not exceed 1000 characters. */ @Size(max = 1000, message = "The negativePromptDecoder field must be at most 1000 characters long.") private String negativePromptDecoder; private String style; }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/exception/FusionBrainErrorDecoder.java
package ai.fusionbrain.exception; import feign.Response; import feign.codec.ErrorDecoder; import lombok.extern.slf4j.Slf4j; @Slf4j public class FusionBrainErrorDecoder implements ErrorDecoder { @Override public Exception decode(String methodKey, Response response) { String message = String.format("Failed request to FusionBrain API. Status: %d, Method: %s", response.status(), methodKey); log.error(message); return new FusionBrainServerException(message); } }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/exception/FusionBrainException.java
package ai.fusionbrain.exception; import lombok.Getter; /** * A generic exception class for FusionBrain. */ @Getter public class FusionBrainException extends RuntimeException { /** * Constructs a new FusionBrainException with the specified detail message. * * @param message The detail message (which is saved for later retrieval by the getMessage() method). */ public FusionBrainException(String message) { super(message); } /** * Constructs a new FusionBrainException with the specified detail message and cause. * * @param message The detail message (which is saved for later retrieval by the getMessage() method). * @param cause The cause (which is saved for later retrieval by the getCause() method). * (A null value is permitted, and indicates that the cause is unknown.) */ public FusionBrainException(String message, Throwable cause) { super(message, cause); } }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/exception/FusionBrainServerException.java
package ai.fusionbrain.exception; /** * This class represents exceptions that occur on the server side within the FusionBrain application. * It extends the base FusionBrainException class to provide specific handling for server-related errors. */ public class FusionBrainServerException extends FusionBrainException { /** * Constructs a new FusionBrainServerException with the specified message. * * @param message The detail message explaining the exception. */ public FusionBrainServerException(String message) { super(message); } /** * Constructs a new FusionBrainServerException with the specified message and cause. * * @param message The detail message explaining the exception. * @param cause The underlying cause of this exception. */ public FusionBrainServerException(String message, Throwable cause) { super(message, cause); } }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/exception/PipelineDisabledException.java
package ai.fusionbrain.exception; /** * Exception thrown when a pipeline is disabled. */ public class PipelineDisabledException extends FusionBrainException { /** * Constructs a new exception with the specified message. * * @param message The detail message. */ public PipelineDisabledException(String message) { super(message); } /** * Constructs a new exception with the specified message and cause. * * @param message The detail message. * @param cause The cause of this exception. */ public PipelineDisabledException(String message, Throwable cause) { super(message, cause); } }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/exception/ValidationException.java
package ai.fusionbrain.exception; /** * Exception thrown when parameter validation fails. * Subtype of FusionBrainException to maintain consistent error handling. */ public class ValidationException extends FusionBrainException { public ValidationException(String message) { super(message); } public ValidationException(String message, Throwable cause) { super(message, cause); } }
0
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain
java-sources/ai/fusionbrain/fusionbrain-spring-boot-starter/1.0.0/ai/fusionbrain/utils/ValidationUtil.java
package ai.fusionbrain.utils; import ai.fusionbrain.exception.ValidationException; import jakarta.validation.ConstraintViolation; import jakarta.validation.Validation; import jakarta.validation.Validator; import java.util.Set; import java.util.stream.Collectors; public class ValidationUtil { /** * Validates the given object using the Jakarta Bean Validation API. * If validation fails, a ValidationException is thrown with details of all violations. * * @param object The object to validate * @throws ValidationException If validation fails */ public static <T> void validate(T object) { try (var factory = Validation.buildDefaultValidatorFactory()) { Validator validator = factory.getValidator(); // Validate the object and collect constraint violations Set<ConstraintViolation<T>> violations = validator.validate(object); // Check if there are any validation errors if (!violations.isEmpty()) { // Generate a user-friendly error message from the violations String errorMessage = violations.stream() .map(v -> v.getPropertyPath() + ": " + v.getMessage()) .collect(Collectors.joining("; ")); throw new ValidationException("Validation failed: " + errorMessage); } } } }
0
java-sources/ai/gams/gams/1.2.2/ai
java-sources/ai/gams/gams/1.2.2/ai/gams/GamsJNI.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams; /** * Abstract class that insures loading of libMADARA.so and holds the C pointer */ public abstract class GamsJNI { static { System.loadLibrary("MADARA"); System.loadLibrary("GAMS"); } /** * C pointer to an object */ private long cptr = 0; /** * Set the C pointer to the object * * @param cptr C Pointer */ protected void setCPtr(long cptr) { this.cptr = cptr; } /** * @return The C pointer of this object for passing to JNI functions */ public long getCPtr() { return cptr; } /** * @return &lt;ClassName&gt;[&lt;C Pointer&gt;] * @see java.lang.Object#toString () */ public String toString() { return getClass().getName() + "[" + cptr + "]"; } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/algorithms/AlgorithmFactory.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.algorithms; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.KnowledgeList; /** * Interface for defining an algorithm factory for creating algorithms * via the command interface in GAMS */ public interface AlgorithmFactory { /** * Creates an algorithm * @param args arguments to the algorithm creation * @param knowledge the knowledge base being used by the controller * @return an instance of a base algorithm **/ BaseAlgorithm create(KnowledgeList args, KnowledgeBase knowledge); }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/algorithms/AlgorithmInterface.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.algorithms; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.exceptions.MadaraDeadObjectException; /** * Interface for defining an algorithm to be used by GAMS. Care must be taken * to make all methods non-blocking, to prevent locking up the underlying * MADARA context. */ public interface AlgorithmInterface { /** * Analyzes the algorithm for new status information. This should be * a non-blocking call. * @return status information (@see AlgorithmStatusEnum) **/ public int analyze () throws MadaraDeadObjectException, GamsDeadObjectException; /** * Plans next steps in the algorithm. This should be * a non-blocking call. * @return status information (@see AlgorithmStatusEnum) **/ public int plan () throws MadaraDeadObjectException, GamsDeadObjectException; /** * Executes next step in the algorithm. This should be * a non-blocking call. * @return status information (@see AlgorithmStatusEnum) * @throws GamsDeadObjectException * @throws MadaraDeadObjectException **/ public int execute () throws MadaraDeadObjectException, GamsDeadObjectException; }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/algorithms/AlgorithmStatusEnum.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.algorithms; /** * AlgorithmStatusEnum of the algorithm */ public enum AlgorithmStatusEnum { UNKNOWN(0), OK(1), WAITING(2), DEADLOCKED(4), FAILED(8), FINISHED(16); private int num; private AlgorithmStatusEnum(int num) { this.num = num; } /** * @return int value of this enum */ public int value() { return num; } /** * Converts an int to an enum * * @param val value to convert * @return unum or null if the int is invalid */ public static AlgorithmStatusEnum getType(int val) { for (AlgorithmStatusEnum t : values()) { if (t.value() == val) return t; } return null; } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/algorithms/BaseAlgorithm.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.algorithms; import ai.gams.GamsJNI; import ai.gams.controllers.BaseController; import ai.gams.exceptions.GamsDeadObjectException; import ai.gams.platforms.BasePlatform; import ai.gams.variables.AlgorithmStatus; import ai.gams.variables.Self; import ai.madara.knowledge.KnowledgeBase; /** * Base class that should be extended when creating a Java algorithm for * usage in the GAMS controller */ public abstract class BaseAlgorithm extends GamsJNI implements AlgorithmInterface { private native long jni_getKnowledgeBase(long cptr); private native long jni_getSelf(long cptr); private native Object jni_getPlatformObject(long cptr); private native long jni_getAlgorithmStatus(long cptr); protected long executions; /** * Initialize the platform with controller variables. Use this * method to synchronize user-defined algorithms with the controller. * @param controller controller which will be using the algorithm **/ public void init (BaseController controller) throws GamsDeadObjectException { controller.initVars (this); platform = (BasePlatform)jni_getPlatformObject(getCPtr()); knowledge = KnowledgeBase.fromPointer(jni_getKnowledgeBase(getCPtr()),false); self = Self.fromPointer(jni_getSelf(getCPtr()),false); status = AlgorithmStatus.fromPointer(jni_getAlgorithmStatus(getCPtr()),false); executions = 0; } /** * Facade for the protected setCPtr method in GamsJNI * @param cptr the C pointer for the underlying class **/ public void assume (long cptr) throws GamsDeadObjectException { setCPtr(cptr); } /** * The controller's current knowledge base **/ public KnowledgeBase knowledge; /** * The platform currently in use by the controller **/ public BasePlatform platform; /** * Self-identifying variables like id and device properties **/ public Self self; /** * The status of the algorithm **/ public AlgorithmStatus status; }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/algorithms/DebugAlgorithmFactory.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.algorithms; import ai.gams.GamsJNI; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.KnowledgeList; /** * A factory for creating debug algorithms */ public class DebugAlgorithmFactory extends GamsJNI implements AlgorithmFactory { /** * Creates an algorithm * @param args arguments to the algorithm creation * @param knowledge the knowledge base being used by the controller * @return an instance of a base algorithm **/ @Override public BaseAlgorithm create(KnowledgeList args, KnowledgeBase knowledge) { return new DebuggerAlgorithm(); } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/algorithms/DebuggerAlgorithm.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.algorithms; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.exceptions.MadaraDeadObjectException; /** * Algorithm settings debugger class */ public class DebuggerAlgorithm extends BaseAlgorithm { /** * Default constructor **/ public DebuggerAlgorithm() { executions = new ai.madara.knowledge.containers.Integer(); } /** * Analyzes the state of the algorithm **/ @Override public int analyze() throws MadaraDeadObjectException, GamsDeadObjectException { executions.setName(knowledge, ".executions"); System.out.println(self.id.get() + ":" + executions.get () + ":Algorithm.analyze called"); if(platform.getCPtr() != 0) { System.out.println(self.id.get() + ":" + executions.get () + ": platform_id: " + platform.getId() + ", platform_name: " + platform.getName()); platform.getPositionAccuracy(); platform.getPosition(); platform.getMinSensorRange(); platform.getMoveSpeed(); } else { System.out.println(self.id.get() + ":" + executions.get () + ": platform is null, so no operations called"); } return AlgorithmStatusEnum.OK.value(); } /** * Plans the next stage of the algorithm **/ @Override public int plan() throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ":Algorithm.plan called"); return AlgorithmStatusEnum.OK.value(); } /** * Executes the next stage of the algorithm **/ @Override public int execute() throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ":Algorithm.execute called"); if(platform.getCPtr() != 0) { platform.takeoff(); platform.home(); platform.land(); platform.move(platform.getPosition(), 2.0); platform.setMoveSpeed(3.0); platform.stopMove(); } else { System.out.println(self.id.get() + ":" + executions.get () + ": platform is null, so no operations called"); } executions.inc(); return AlgorithmStatusEnum.OK.value(); } private ai.madara.knowledge.containers.Integer executions; }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/algorithms/MessageProfiling.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author Anton Dukeman <anton.dukeman@gmail.com> *********************************************************************/ package ai.gams.algorithms; import java.util.HashMap; import java.util.HashSet; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.exceptions.MadaraDeadObjectException; import ai.madara.knowledge.Variables; import ai.madara.transport.TransportContext; import ai.madara.transport.filters.Packet; /** * Base class that should be extended when creating a Java algorithm for * usage in the GAMS controller */ public class MessageProfiling extends BaseAlgorithm { private static final String keyPrefix = "message_profiling"; /** * @class MessageProfilingFilter * @brief The MessageProfilingFilter counts the expected messages received to * the KnowledgeBase **/ private class MessageProfilingFilter implements ai.madara.transport.filters.AggregateFilter { /** * MessageData struct */ private class MessageData { public ai.madara.knowledge.containers.Integer first; public ai.madara.knowledge.containers.Integer last; public ai.madara.knowledge.containers.Double percentMissing; public HashSet<Long> missing; MessageData (String id, ai.madara.knowledge.Variables var) throws MadaraDeadObjectException { String prefix = new String ("." + keyPrefix + "." + id + "."); first = new ai.madara.knowledge.containers.Integer (); ai.madara.logger.GlobalLogger.log (6, "first.set_name"); first.setName (var, prefix + "first"); first.set (-1); last = new ai.madara.knowledge.containers.Integer (); ai.madara.logger.GlobalLogger.log (6, "last.set_name"); last.setName (var, prefix + "last"); percentMissing = new ai.madara.knowledge.containers.Double (); ai.madara.logger.GlobalLogger.log (6, "percent_missing.set_name"); percentMissing.setName (var, prefix + "percent_missing"); missing = new HashSet<Long> (); } }; /** * Keep a MessageData struct for each peer */ HashMap<String, MessageData> msgMap; /** * Filter the incoming packets */ public void filter (Packet packet, TransportContext context, Variables variables) throws MadaraDeadObjectException { // get/construct data struct String origin = context.getOriginator (); if (msgMap.get (origin) == null) { msgMap.put (origin, new MessageData(origin, variables)); } MessageData data = msgMap.get (origin); // loop through each update for (String key : packet.getKeys ()) { // we only care about specific messages ai.madara.knowledge.KnowledgeRecord record = packet.get (key); if (record.getType () == ai.madara.knowledge.KnowledgeType.STRING && record.toString ().indexOf (keyPrefix) == 0) { // get msg number String[] split = record.toString ().split (","); long msgNum = Long.parseLong (split[0]); // is this the first? if (data.first.toLong () == -1) { data.first.set (msgNum); data.last.set (msgNum); } // is this a previously missing message? else if (msgNum < data.last.toLong ()) { // is this earlier than first? if (msgNum < data.first.toLong ()) { for (long i = msgNum + 1; i < data.first.toLong (); ++i) data.missing.add (i); data.first.set (msgNum); } else // it is between first and last, remove from missing set { data.missing.remove (msgNum); } } else // this could only be a new message past last { for (long i = data.last.toLong () + 1; i < msgNum; ++i) data.missing.add (i); data.last.set (msgNum); } long expected = data.first.toLong () - data.last.toLong () + 1; data.percentMissing.set ((double)data.missing.size () / (double) expected); } } } } /** * Filter object */ private MessageProfilingFilter filter; /** * Message container */ private ai.madara.knowledge.containers.String message; /** * Constructor **/ public MessageProfiling () { message = new ai.madara.knowledge.containers.String (); filter = new MessageProfilingFilter (); } /** * Initialize values, must be called after initAlgorithm for controller that will run algorithm * NOTE: DISABLED UNTIL KnowledgeBase.attachTransport (String, TransportSettings) is added to MADARA */ // public void initVars (ai.madara.transport.QoSTransportSettings settings) // { // // attach filter // settings.addReceiveFilter (filter); // // // attach transport // knowledge.attachTransport (knowledge.getID (), settings); // // // create message container // final String key = new String (keyPrefix + "." + // knowledge.get (".id").toString () + ".data"); // message.setName (knowledge, key); // } /** * Analyzes the algorithm for new status information. This should be * a non-blocking call. * @return status information (@see Status) **/ public int analyze () { return ai.gams.algorithms.AlgorithmStatusEnum.OK.value(); } /** * Plans next steps in the algorithm. This should be * a non-blocking call. * @return status information (@see Status) **/ public int plan () { return ai.gams.algorithms.AlgorithmStatusEnum.OK.value(); } /** * Executes next step in the algorithm. This should be * a non-blocking call. * @return status information (@see Status) **/ public int execute () throws MadaraDeadObjectException, GamsDeadObjectException { ++executions; // construct value String value = Long.toString (executions); value += ",aaaaaaaaaaaaaaaaaa"; // actually set knowledge message.set (value); return ai.gams.algorithms.AlgorithmStatusEnum.OK.value(); } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/controllers/BaseController.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.controllers; import ai.gams.GamsJNI; import ai.gams.algorithms.AlgorithmFactory; import ai.gams.algorithms.BaseAlgorithm; import ai.gams.algorithms.DebuggerAlgorithm; import ai.gams.exceptions.GamsDeadObjectException; import ai.gams.platforms.BasePlatform; import ai.gams.platforms.DebuggerPlatform; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.KnowledgeList; public class BaseController extends GamsJNI { private native long jni_BaseControllerFromKb(long cptr) throws GamsDeadObjectException; private native long jni_BaseController(long cptr) throws GamsDeadObjectException; private static native void jni_freeBaseController(long cptr) throws GamsDeadObjectException; private native java.lang.String jni_toString(long cptr) throws GamsDeadObjectException; private native long jni_analyze(long cptr) throws GamsDeadObjectException; private native long jni_execute(long cptr) throws GamsDeadObjectException; private native long jni_getPlatform(long cptr) throws GamsDeadObjectException; private native long jni_getAlgorithm(long cptr) throws GamsDeadObjectException; private native void jni_addAlgorithmFactory(long cptr, java.lang.String name, Object factory) throws GamsDeadObjectException; private native void jni_initAccent(long cptr, java.lang.String name, long[] args) throws GamsDeadObjectException; private native void jni_initAlgorithm(long cptr, java.lang.String name, long[] args) throws GamsDeadObjectException; private native void jni_initPlatform(long cptr, java.lang.String name) throws GamsDeadObjectException; private native void jni_initPlatform(long cptr, java.lang.String name, long[] args) throws GamsDeadObjectException; private native void jni_initAlgorithm(long cptr, Object algorithm) throws GamsDeadObjectException; private native void jni_initPlatform(long cptr, Object platform) throws GamsDeadObjectException; private native void jni_initVars(long cptr, long id, long processes) throws GamsDeadObjectException; private native void jni_initVarsAlgorithm(long cptr, long algorithm) throws GamsDeadObjectException; private native void jni_initVarsPlatform(long cptr, long platform) throws GamsDeadObjectException; private native long jni_monitor(long cptr) throws GamsDeadObjectException; private native long jni_plan(long cptr) throws GamsDeadObjectException; private native long jni_run(long cptr, double period, double max) throws GamsDeadObjectException; private native long jni_run(long cptr, double loopPeriod, double max, double sendPeriod) throws GamsDeadObjectException; private native long jni_runHz(long cptr, double loopHz, double max, double sendHz) throws GamsDeadObjectException; private native long jni_systemAnalyze(long cptr) throws GamsDeadObjectException; private BaseAlgorithm algorithm = null; private BasePlatform platform = null; private long id = 0; private long processes = 1; private boolean manageMemory = true; /** * Constructor from C pointers * @param cptr the C-style pointer to the Base_Controller class instance */ private BaseController(long cptr) { setCPtr(cptr); } /** * Constructor * @param knowledge knowledge base to use */ public BaseController(KnowledgeBase knowledge) throws GamsDeadObjectException { setCPtr(jni_BaseControllerFromKb(knowledge.getCPtr ())); initVars(0, 1); initPlatform(new DebuggerPlatform ()); initAlgorithm(new DebuggerAlgorithm ()); } /** * Copy constructor * @param input the instance to copy */ public BaseController(BaseController input) throws GamsDeadObjectException { setCPtr(jni_BaseController(input.getCPtr())); } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer **/ public static BaseController fromPointer(long cptr, boolean shouldManage) { BaseController ret = new BaseController(cptr); ret.manageMemory=shouldManage; return ret; } /** * Analyzes the platform, algorithm and accents * @return status of analyze. 0 is full success, though this is not * currently checked. **/ public long analyze () throws GamsDeadObjectException { return jni_analyze(getCPtr()); } /** * Executes the algorithm and accents * @return status of execute. 0 is full success, though this is not * currently checked. **/ public long execute () throws GamsDeadObjectException { return jni_execute(getCPtr()); } /** * Initialize an accent within the controller * * @param name name of the accent * @param args arguments to the accent initialization */ public void initAccent(java.lang.String name, KnowledgeList args) throws GamsDeadObjectException { jni_initAccent(getCPtr(), name, args.toPointerArray()); } /** * Initialize an algorithm within the controller * * @param name name of the algorithm * @param args arguments to the algorithm initialization */ public void initAlgorithm(java.lang.String name, KnowledgeList args) throws GamsDeadObjectException { jni_initAlgorithm(getCPtr(), name, args.toPointerArray()); } /** * Adds a named algorithm factory to the controller, which allows for usage * of the named factory in swarm.command and device.*.command * @param name the string name to associate with the factory * @param factory the factory that creates the algorithm */ public void addAlgorithmFactory( java.lang.String name, AlgorithmFactory factory) throws GamsDeadObjectException { jni_addAlgorithmFactory(getCPtr(), name, factory); } /** * Initialize a platform within the controller * * @param name name of the platform */ public void initPlatform(java.lang.String name) throws GamsDeadObjectException { jni_initPlatform(getCPtr(), name); } /** * Initialize a platform within the controller * * @param name name of the platform * @param args arguments to the platform initialization */ public void initPlatform(java.lang.String name, KnowledgeList args) throws GamsDeadObjectException { jni_initPlatform(getCPtr(), name, args.toPointerArray()); } /** * Initialize an algorithm within the controller * * @param algorithm the algorithm to add to the controller */ public void initAlgorithm(BaseAlgorithm algorithm) throws GamsDeadObjectException { this.algorithm = algorithm; jni_initAlgorithm(getCPtr(), algorithm); algorithm.assume(jni_getAlgorithm(getCPtr())); algorithm.init(this); } /** * Initialize a platform within the controller * * @param platform platform to add to the controller */ public void initPlatform(BasePlatform platform) throws GamsDeadObjectException { this.platform = platform; jni_initPlatform(getCPtr(), platform); platform.assume(jni_getPlatform(getCPtr())); platform.init(this); } /** * Initialize the variables within the controller * * @param id the id of this process within the swarm * @param processes the number of processes participating in the swarm */ public void initVars(long id, long processes) throws GamsDeadObjectException { this.id = id; this.processes = processes; jni_initVars(getCPtr(), id, processes); // if the user setup the platform, initialize with the new id if(platform != null) { platform.init(this); } // if the user setup the platform, initialize with the new id if(algorithm != null) { algorithm.init(this); } } /** * Initialize the variables for a platform. This function is useful * for user-defined platforms and essentially shares the controller's * KnowledgeBase, self-identifying variables, etc. * * @param platform the user-defined platform */ public void initVars(BasePlatform platform) throws GamsDeadObjectException { jni_initVarsPlatform(getCPtr(), platform.getCPtr ()); } /** * Initialize the variables for an algorithm. This function is useful * for user-defined algorithms and essentially shares the controller's * KnowledgeBase, self-identifying variables, etc. * * @param algorithm the user-defined algorithm */ public void initVars(BaseAlgorithm algorithm) throws GamsDeadObjectException { jni_initVarsAlgorithm(getCPtr(), algorithm.getCPtr ()); } /** * Monitors the platform's sensors * @return status of monitor. 0 is full success, though this is not * currently checked. **/ public long monitor () throws GamsDeadObjectException { return jni_monitor(getCPtr()); } /** * Plans the algorithm and accents * @return status of plan. 0 is full success, though this is not * currently checked. **/ public long plan () throws GamsDeadObjectException { return jni_plan(getCPtr()); } /** * Runs the monitor, analyze, plan and execute loop with a * specific period and duration * @param period the time in between executions of the loop in seconds * @param duration the duration of the loop in seconds * @return status of run. 0 is full success, though this is not * currently checked. **/ public long run (double period, double duration) throws GamsDeadObjectException { return jni_run(getCPtr(), period, duration); } /** * Runs iterations of the MAPE loop with specified periods between loops * @param loopPeriod time in seconds between executions of the loop. 0 * means run as fast as possible (no sleeps). * @param duration the duration of time spent running the loop in seconds. * Negative duration means run loop forever. 0 duration * means run once. * @param sendPeriod time in seconds between sending updates over network. * If sendPeriod is non-positive, loopPeriod is used. * @return status of run. 0 is full success, though this is not * currently checked. **/ public long run (double loopPeriod, double duration, double sendPeriod) throws GamsDeadObjectException { return jni_run(getCPtr(), loopPeriod, duration, sendPeriod); } /** * Runs iterations of the MAPE loop with specified hertz * @param loopHz the intended hz at which the loop should execute. * anything non-negative is valid. 0hz is treated as * as infinite hertz (i.e., run as fast as possible). * @param duration the duration of time spent running the loop in seconds. * Negative duration means run loop forever. 0 duration means * run once. * @param sendHz the intended hz at which updates should be sent. If * non-positive, loopHz is used. * @return the result of the MAPE loop * @return status of run. 0 is full success, though this is not * currently checked. **/ public long runHz (double loopHz, double duration, double sendHz) throws GamsDeadObjectException { return jni_runHz(getCPtr(), loopHz, duration, sendHz); } /** * Analyzes the controller and system * @return status of analyze. 0 is full success, though this is not * currently checked. **/ public long systemAnalyze () throws GamsDeadObjectException { return jni_systemAnalyze(getCPtr()); } /** * Converts the value to a string * * @return current string value */ public java.lang.String toString() { return "BaseController"; } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance of WaitSettings gets garbage collected */ public void free() throws GamsDeadObjectException { if (manageMemory) { jni_freeBaseController(getCPtr()); } setCPtr(0); } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/exceptions/GamsDeadObjectException.java
package ai.gams.exceptions; import ai.madara.exceptions.MadaraDeadObjectException; public class GamsDeadObjectException extends Exception { /** * version */ private static final long serialVersionUID = 1L; /** * Constructor */ public GamsDeadObjectException() { } /** * Constructor with message * @param message information to embed in the exception */ public GamsDeadObjectException(String message) { super(message); } /** * Constructor with cause * @param cause source of the exception */ public GamsDeadObjectException(Throwable cause) { super(cause); } /** * Constructor with cause and message * @param message information to embed in the exception * @param cause source of the exception */ public GamsDeadObjectException(String message, Throwable cause) { super(message, cause); } /** * Constructor with cause and message and suppression * @param message information to embed in the exception * @param cause source of the exception * @param enableSuppression if true, suppress the throw * @param writableStackTrace if true, write stack trace */ public GamsDeadObjectException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/logger/GlobalLogger.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.logger; import ai.gams.GamsJNI; import ai.madara.logger.Logger; /** * A facade for the GAMS logging service **/ public class GlobalLogger extends GamsJNI { private static native long jni_getCPtr(); private static native void jni_setLevel(int level); private static native int jni_getLevel(); private static native java.lang.String jni_getTag(); private static native void jni_setTag(java.lang.String tag); private static native void jni_addTerm(); private static native void jni_addSyslog(); private static native void jni_clear(); private static native void jni_addFile(java.lang.String filename); private static native void jni_log(int level, java.lang.String message); private static native void jni_setTimestampFormat(java.lang.String format); /** * Default constructor **/ public GlobalLogger() { setCPtr(jni_getCPtr()); } /** * Gets the tag used in system logging * * @return current tag for system logging */ public static java.lang.String getTag() { return jni_getTag(); } /** * Gets the logging level, e.g., where 0 is EMERGENCY and 6 is DETAILED * * @return the current logging level */ public static int getLevel() { return jni_getLevel(); } /** * Gets the logging level, e.g., where 0 is EMERGENCY and 6 is DETAILED * * @return the current logging level */ public static Logger toLogger() { return Logger.fromPointer(jni_getCPtr(), false); } /** * Sets the tag used for system logging * @param tag the tag to be used for system logging */ public static void setTag(java.lang.String tag) { jni_setTag(tag); } /** * Sets the logging level * * @param level level of message severity to print to log targets */ public static void setLevel(int level) { jni_setLevel(level); } /** * Clears all logging targets */ public static void clear() { jni_clear(); } /** * Adds the terminal to logging outputs (turned on by default) */ public static void addTerm() { jni_addTerm(); } /** * Adds the system logger to logging outputs */ public static void addSyslog() { jni_addSyslog(); } /** * Adds a file to logging outputs * @param filename the name of a file to add to logging targets */ public static void addFile(java.lang.String filename) { jni_addFile(filename); } /** * Logs a message at the specified level * @param level the logging severity level (0 is high) * @param message the message to send to all logging targets */ public static void log(int level, java.lang.String message) { jni_log(level, message); } /** * Sets timestamp format. Uses * <a href="http://www.cplusplus.com/reference/ctime/strftime/">strftime</a> * for formatting time. * @param format the format of the timestamp. See C++ * strftime definition for common usage. **/ public static void setTimestampFormat(java.lang.String format) { jni_setTimestampFormat(format); } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/logger/LogLevels.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.logger; public enum LogLevels { LOG_NOTHING (-1), LOG_EMERGENCY (0), LOG_ALWAYS (0), LOG_ERROR (1), LOG_WARNING (2), LOG_MAJOR (3), LOG_MINOR (4), LOG_TRACE (5), LOG_DETAILED (6), LOG_MAX (6); private int num; private LogLevels(int num) { this.num = num; } /** * Get the integer value of this enum * * @return value of the enum */ public int value() { return num; } public static LogLevels getType(int val) { for (LogLevels t : values()) { if (t.value() == val) return t; } return null; } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/platforms/BasePlatform.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.platforms; import ai.gams.GamsJNI; import ai.gams.controllers.BaseController; import ai.gams.exceptions.GamsDeadObjectException; import ai.gams.variables.PlatformStatus; import ai.gams.variables.Self; import ai.madara.knowledge.KnowledgeBase; /** * Base class that should be extended when creating a Java platform for * usage in the GAMS controller */ public abstract class BasePlatform extends GamsJNI implements PlatformInterface { private native long jni_getKnowledgeBase(long cptr); private native long jni_getSelf(long cptr); private native long jni_getPlatformStatus(long cptr); /** * Initialize the platform with controller variables. Use this * method to synchronize user-defined platforms with the controller. * @param controller the controller that will be running the platform loop **/ public void init (BaseController controller) throws GamsDeadObjectException { controller.initVars (this); knowledge = KnowledgeBase.fromPointer(jni_getKnowledgeBase(getCPtr()),false); self = Self.fromPointer(jni_getSelf(getCPtr()),false); status = ai.gams.variables.PlatformStatus.fromPointer(jni_getPlatformStatus(getCPtr()),false); } /** * Facade for the protected setCPtr method in GamsJNI * @param cptr the C pointer for the underlying class **/ public void assume (long cptr) throws GamsDeadObjectException { setCPtr(cptr); } /** * The controller's current knowledge base **/ public KnowledgeBase knowledge; /** * Self-identifying variables like id and device properties **/ public Self self; /** * The status of the platform **/ public PlatformStatus status; }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/platforms/DebuggerPlatform.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.platforms; import ai.gams.exceptions.GamsDeadObjectException; import ai.gams.utility.Axes; import ai.gams.utility.Position; import ai.madara.exceptions.MadaraDeadObjectException; /** * Interface for defining a platform to be used by GAMS. Care must be taken * to make all methods non-blocking, to prevent locking up the underlying * MADARA context. */ public class DebuggerPlatform extends BasePlatform { /** * Default constructor **/ public DebuggerPlatform() { executions = new ai.madara.knowledge.containers.Integer(); } /** * Analyzes the platform. * @return status information(@see PlatformStatusEnum) **/ public int analyze() throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ":Platform.analyze called"); return PlatformStatusEnum.OK.value(); } /** * Returns the accuracy in meters * @return accuracy **/ public double getAccuracy() throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ": Platform.getAccuracy called"); return 0.0; } /** * Returns the position accuracy in meters * @return position accuracy **/ public double getPositionAccuracy() throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ": Platform.getPositionAccuracy called"); return 0.0; } /** * Returns the current GPS position **/ public Position getPosition() throws MadaraDeadObjectException, GamsDeadObjectException { Position position = new Position(0.0, 0.0, 0.0); System.out.println(self.id.get() + ":" + executions.get () + ": Platform.getPosition called"); return position; } /** * Returns to the home location. This should be * a non-blocking call. * @return status information(@see PlatformStatusEnum) **/ public int home() throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ": Platform.home called"); return PlatformStatusEnum.OK.value(); } /** * Requests the platform to land. This should be * a non-blocking call. * @return status information(@see PlatformStatusEnum) **/ public int land() throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ": Platform.land called"); return PlatformStatusEnum.OK.value(); } /** * Initializes a move to the target position. This should be * a non-blocking call. * @param target the new position to move to * @param proximity the minimum distance between current position * and target position that terminates the move. * @return status information(@see PlatformStatusEnum) **/ public int move(Position target, double proximity) throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ": Platform.move called"); return PlatformStatusEnum.OK.value(); } /** * Initializes a rotate along x, y, z axes. This should be * a non-blocking call and implements an extrinsic rotation. * @param target the new extrinsic rotation angles * @return status information(@see PlatformStatusEnum) **/ public int rotate(Axes target) throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ": Platform.rotate called"); return PlatformStatusEnum.OK.value(); } /** * Get sensor radius * @return minimum radius of all available sensors for this platform */ public double getMinSensorRange() throws MadaraDeadObjectException { System.out.println(self.id.get() + ": Platform.getMinSensorRange called"); return 0.0; } /** * Gets the movement speed * @return movement speed **/ public double getMoveSpeed() throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ": Platform.getMoveSpeed called"); return 0.0; } /** * Gets the unique id of the platform. This should be an alphanumeric * id that can be part of a MADARA variable name. Specifically, this * is used in the variable expansion of .platform.{yourid}.* * @return the id of the platform(alphanumeric only: no spaces!) **/ public java.lang.String getId() { return "java_debugger"; } /** * Gets the name of the platform * @return the name of the platform **/ public java.lang.String getName() { return "Java Debugger"; } /** * Gets results from the platform's sensors. This should be * a non-blocking call. * @return 1 if moving, 2 if arrived, 0 if an error occurred **/ public int sense() throws MadaraDeadObjectException, GamsDeadObjectException { executions.setName(knowledge, ".executions"); System.out.println(self.id.get() + ":" + executions.get () + ":Platform.sense called"); Position position = getPosition(); self.agent.location.set(0,position.getX()); self.agent.location.set(1,position.getY()); self.agent.location.set(2,position.getZ()); return PlatformStatusEnum.OK.value(); } /** * Sets move speed * @param speed new speed in meters/second * @throws MadaraDeadObjectException **/ public void setMoveSpeed(double speed) throws MadaraDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ": Platform.setMoveSpeed called with " + speed); } /** * Takes off. This should be * a non-blocking call. * @return status information(@see PlatformStatusEnum) **/ public int takeoff() throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ": Platform.takeoff called"); return PlatformStatusEnum.OK.value(); } /** * Stops moving **/ public void stopMove() throws MadaraDeadObjectException, GamsDeadObjectException { System.out.println(self.id.get() + ":" + executions.get () + ": Platform.stopMove called"); } private ai.madara.knowledge.containers.Integer executions; }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/platforms/PlatformInterface.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.platforms; import ai.gams.exceptions.GamsDeadObjectException; import ai.gams.utility.Axes; import ai.gams.utility.Position; import ai.madara.exceptions.MadaraDeadObjectException; /** * Interface for defining a platform to be used by GAMS. Care must be taken * to make all methods non-blocking, to prevent locking up the underlying * MADARA context. */ public interface PlatformInterface { /** * Analyzes the platform. This should be * a non-blocking call. * @return status information (@see PlatformStatusEnum) **/ public int analyze () throws MadaraDeadObjectException, GamsDeadObjectException; /** * Returns the accuracy in meters * @return the accuracy of the platform **/ public double getAccuracy () throws MadaraDeadObjectException, GamsDeadObjectException; /** * Returns the position accuracy in meters * @return position accuracy **/ public double getPositionAccuracy () throws MadaraDeadObjectException, GamsDeadObjectException; /** * Returns the current position * @return the current position of the device/agent **/ public Position getPosition () throws MadaraDeadObjectException, GamsDeadObjectException; /** * Returns to the home location. This should be * a non-blocking call. * @return status information (@see PlatformReturnStatusEnum) **/ public int home () throws MadaraDeadObjectException, GamsDeadObjectException; /** * Requests the platform to land. This should be * a non-blocking call. * @return status information (@see PlatformReturnStatusEnum) **/ public int land () throws MadaraDeadObjectException, GamsDeadObjectException; /** * Initializes a move to the target position. This should be * a non-blocking call. * @param target the new position to move to * @param proximity the minimum distance between current position * and target position that terminates the move. * @return status information (@see PlatformReturnStatusEnum) **/ public int move (Position target, double proximity) throws MadaraDeadObjectException, GamsDeadObjectException; /** * Initializes a rotate along x, y, z axes. This should be * a non-blocking call and implements an extrinsic rotation. * @param axes parameters for rotation along x, y, z axes * @return status information (@see PlatformReturnStatusEnum) **/ public int rotate (Axes axes) throws MadaraDeadObjectException, GamsDeadObjectException; /** * Get sensor radius * @return minimum radius of all available sensors for this platform * @throws MadaraDeadObjectException */ public double getMinSensorRange () throws GamsDeadObjectException, MadaraDeadObjectException; /** * Gets the movement speed * @return movement speed * @throws MadaraDeadObjectException **/ public double getMoveSpeed () throws GamsDeadObjectException, MadaraDeadObjectException; /** * Gets the unique id of the platform. This should be an alphanumeric * id that can be part of a MADARA variable name. Specifically, this * is used in the variable expansion of .platform.{yourid}.* * @return the id of the platform (alphanumeric only: no spaces!) **/ public java.lang.String getId (); /** * Gets the name of the platform * @return the name of the platform **/ public java.lang.String getName (); /** * Gets results from the platform's sensors. This should be * a non-blocking call. * @return the status of the platform, @see PlatformStatusEnum * @throws GamsDeadObjectException * @throws MadaraDeadObjectException **/ public int sense () throws GamsDeadObjectException, MadaraDeadObjectException; /** * Sets move speed * @param speed new speed in meters/second * @throws MadaraDeadObjectException **/ public void setMoveSpeed (double speed) throws MadaraDeadObjectException; /** * Takes off. This should be * a non-blocking call. * @return status information (@see PlatformReturnStatusEnum) * @throws GamsDeadObjectException * @throws MadaraDeadObjectException **/ public int takeoff () throws MadaraDeadObjectException, GamsDeadObjectException; /** * Stops moving * @throws GamsDeadObjectException * @throws MadaraDeadObjectException **/ public void stopMove () throws MadaraDeadObjectException, GamsDeadObjectException; }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/platforms/PlatformReturnStatusEnum.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.platforms; /** * An enumeration of possible return values from functions like move, home, * and other methods defined in @see PlatformInterface */ public enum PlatformReturnStatusEnum { //These are defined in platforms/Base.h PLATFORM_ERROR(0), PLATFORM_IN_PROGRESS(1), PLATFORM_MOVING(1), PLATFORM_ARRIVED(2); private int num; private PlatformReturnStatusEnum(int num) { this.num = num; } /** * @return int value of this {@link ai.gams.platforms.PlatformReturnStatusEnum PlatformReturnStatusEnum} */ public int value() { return num; } /** * Converts an int to a {@link ai.gams.platforms.PlatformReturnStatusEnum * PlatformReturnStatusEnum} * * @param val value to convert * @return {@link ai.gams.platforms.PlatformReturnStatusEnum * PlatformReturnStatusEnum} or null if the int is invalid */ public static PlatformReturnStatusEnum getType(int val) { for (PlatformReturnStatusEnum t : values()) { if (t.value() == val) return t; } return null; } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/platforms/PlatformStatusEnum.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.platforms; /** * PlatformStatusEnum of the platform */ public enum PlatformStatusEnum { //These are defined in platforms/Base.h UNKNOWN(0), OK(1), WAITING(2), DEADLOCKED(4), FAILED(8), MOVING(16), REDUCED_SENSING_AVAILABLE(128), REDUCED_MOVEMENT_AVAILABLE(256), COMMUNICATION_AVAILABLE(512), SENSORS_AVAILABLE(1024), MOVEMENT_AVAILABLE(2048); private int num; private PlatformStatusEnum(int num) { this.num = num; } /** * @return int value of this {@link ai.gams.platforms.PlatformStatusEnum PlatformStatusEnum} */ public int value() { return num; } /** * Converts an int to a {@link ai.gams.platforms.PlatformStatusEnum PlatformStatusEnum} * * @param val value to convert * @return {@link ai.gams.platforms.PlatformStatusEnum PlatformStatusEnum} or null if the int is invalid */ public static PlatformStatusEnum getType(int val) { for (PlatformStatusEnum t : values()) { if (t.value() == val) return t; } return null; } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/tests/TestDebuggerLoop.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.tests; import ai.gams.algorithms.DebugAlgorithmFactory; import ai.gams.controllers.BaseController; import ai.gams.utility.Logging; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.KnowledgeList; public class TestDebuggerLoop { public static void main (String...args) throws Exception { Logging.setLevel(6); System.out.println("Creating knowledge base..."); KnowledgeBase knowledge = new KnowledgeBase(); System.out.println("Passing knowledge base to base controller..."); BaseController controller = new BaseController(knowledge); System.out.println("Creating debug algorithm factory..."); DebugAlgorithmFactory debugFactory = new DebugAlgorithmFactory(); System.out.println("Adding debug algorithm factory as 'java-debug'..."); controller.addAlgorithmFactory("java-debug", debugFactory); KnowledgeList list = new KnowledgeList(); System.out.println("Initializing 'java-debug' algorithm..."); controller.initAlgorithm("java-debug", list); System.out.println("Running controller every 1s for 10s..."); controller.run(1.0, 200.0); controller.free(); knowledge.free(); } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/tests/TestDebuggerLoopFilters.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.tests; import ai.gams.controllers.BaseController; import ai.madara.knowledge.KnowledgeBase; import ai.madara.transport.QoSTransportSettings; import ai.madara.transport.TransportType; import ai.madara.transport.filters.LogAggregate; public class TestDebuggerLoopFilters { public static void main (String...args) throws Exception { //Logging logger = new Logging(); //Logging.setLevel(10); System.out.println("Creating QoS Transport Settings..."); QoSTransportSettings transportSettings = new QoSTransportSettings(); System.out.println("Adding LogAggregate() to settings..."); transportSettings.addSendFilter(new LogAggregate()); System.out.println("Adding multicast to settings..."); transportSettings.setHosts(new String[]{"239.255.0.1:4150"}); transportSettings.setType(TransportType.MULTICAST_TRANSPORT); System.out.println("Creating knowledge base..."); KnowledgeBase knowledge = new KnowledgeBase("", transportSettings); System.out.println("Passing knowledge base to base controller..."); BaseController controller = new BaseController(knowledge); System.out.println("Running controller every 1s for 10s..."); controller.run(1.0, 10.0); System.out.println("Printing resulting knowledges..."); knowledge.print(); controller.free(); transportSettings.free(); knowledge.free(); } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/tests/TestMessageProfilingAlgorithm.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author Anton Dukeman <anton.dukeman@gmail.com> *********************************************************************/ package ai.gams.tests; public class TestMessageProfilingAlgorithm { public String host; public long duration; public double rate; public int id; public TestMessageProfilingAlgorithm () { host = ""; duration = 10; rate = 2; id = 0; } // DISABLED UNTIL TRANSPORT CHANGES ADDED TO MADARA public void test () { // // select transport // QoSTransportSettings settings = new QoSTransportSettings (); // // // set host // String[] hosts = new String[1]; // hosts[0] = "239.255.0.1:4150"; // settings.setHosts(hosts); // // // select multicast // settings.setType (ai.madara.transport.TransportType.MULTICAST_TRANSPORT); // // // create Knowledge Base // KnowledgeBase knowledge = new KnowledgeBase (host, settings); // // // set initial variables // knowledge.set (".id", id); // // // create controller // BaseController controller = new BaseController (knowledge); // // // init platform // controller.initPlatform ("null"); // // // init algorithm // MessageProfiling algo = new MessageProfiling (); // controller.initAlgorithm (algo); // algo.initVars (settings); // // // run controller // controller.run (1.0 / rate, duration); } public static void parseArgs (String[] args, TestMessageProfilingAlgorithm obj) { for (int i = 0; i < args.length; ++i) { if (args[i].equals ("-h") || args[i].equals("--host")) { obj.host = args[i + 1]; } else if (args[i].equals ("-d") || args[i].equals ("--duration")) { obj.duration = Long.parseLong (args[i + 1]); } else if (args[i].equals ("-r") || args[i].equals ("--rate")) { obj.rate = Double.parseDouble (args[i + 1]); } else if (args[i].equals ("-i") || args[i].equals ("--id")) { obj.id = Integer.parseInt (args[i + 1]); } else { System.err.println ("Invalid argument: \"" + args[i] + "\""); System.exit (-1); } ++i; } } public static void main (String[] args) { TestMessageProfilingAlgorithm obj = new TestMessageProfilingAlgorithm (); parseArgs (args, obj); ai.madara.logger.GlobalLogger.setLevel(6); obj.test (); ai.madara.logger.GlobalLogger.setLevel(0); } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/tests/TestMessagingThroughput.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author Anton Dukeman <anton.dukeman@gmail.com> *********************************************************************/ package ai.gams.tests; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.exceptions.MadaraDeadObjectException; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.Variables; import ai.madara.transport.QoSTransportSettings; import ai.madara.transport.TransportContext; import ai.madara.transport.filters.Packet; public class TestMessagingThroughput { public String type; public String host; public long duration; public double rate; public TestMessagingThroughput () { host = ""; duration = 10; rate = 2; } private class CounterFilter implements ai.madara.transport.filters.AggregateFilter { public int counter; public CounterFilter () { counter = 0; } public void filter (Packet packet, TransportContext context, Variables variables) { ++counter; } } public void testReader () throws MadaraDeadObjectException, GamsDeadObjectException { QoSTransportSettings settings = new QoSTransportSettings (); CounterFilter filter = new CounterFilter (); settings.addReceiveFilter (filter); final String default_multicast = new String ("239.255.0.1:4150"); String[] hosts = new String[1]; hosts[0] = default_multicast; settings.setHosts (hosts); settings.setType (ai.madara.transport.TransportType.MULTICAST_TRANSPORT); KnowledgeBase kb = new KnowledgeBase(host, settings); ai.madara.util.Utility.sleep (duration); ai.madara.logger.GlobalLogger.log (6, "Counter: " + filter.counter); } public void testWriter () throws MadaraDeadObjectException, GamsDeadObjectException { QoSTransportSettings settings = new QoSTransportSettings (); final String default_multicast = new String ("239.255.0.1:4150"); String[] hosts = new String[1]; hosts[0] = default_multicast; settings.setHosts (hosts); settings.setType (ai.madara.transport.TransportType.MULTICAST_TRANSPORT); KnowledgeBase kb = new KnowledgeBase(host, settings); int iterations = (int) duration * (int) rate; for (int i = 0; i < iterations; ++i) { kb.set ("data", 1); ai.madara.util.Utility.sleep (1 / rate); } } public void testBoth () throws MadaraDeadObjectException, GamsDeadObjectException { QoSTransportSettings settings = new QoSTransportSettings (); CounterFilter filter = new CounterFilter (); settings.addReceiveFilter (filter); final String default_multicast = new String ("239.255.0.1:4150"); String[] hosts = new String[1]; hosts[0] = default_multicast; settings.setHosts (hosts); settings.setType (ai.madara.transport.TransportType.MULTICAST_TRANSPORT); KnowledgeBase kb = new KnowledgeBase(host, settings); int iterations = (int) duration * (int) rate; for (int i = 0; i < iterations; ++i) { kb.set ("data", 1); ai.madara.util.Utility.sleep (1 / rate); } ai.madara.logger.GlobalLogger.log (6, "Counter: " + filter.counter); } public static void parseArgs (String[] args, TestMessagingThroughput obj) { for (int i = 0; i < args.length; ++i) { if (args[i] == "-t" || args[i] == "--type") { obj.type = args[i + 1]; } else if (args[i] == "-h" || args[i] == "--host") { obj.host = args[i + 1]; } else if (args[i] == "-d" || args[i] == "--duration") { obj.duration = Long.parseLong (args[i + 1]); } else if (args[i] == "-r" || args[i] == "--rate") { obj.rate = Double.parseDouble (args[i + 1]); } else { System.err.println ("Invalid argument: " + args[i]); System.exit (-1); } ++i; } } public static void main (String[] args) throws MadaraDeadObjectException, GamsDeadObjectException { TestMessagingThroughput obj = new TestMessagingThroughput (); parseArgs (args, obj); switch (obj.type) { case "reader": obj.testReader (); break; case "writer": obj.testWriter (); break; case "both": obj.testBoth (); break; default: System.out.println ("Invalid type specified: " + obj.type); System.exit (-1); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/tests/TestMultiController.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.tests; import ai.gams.algorithms.DebuggerAlgorithm; import ai.gams.controllers.BaseController; import ai.gams.exceptions.GamsDeadObjectException; import ai.gams.platforms.DebuggerPlatform; import ai.madara.exceptions.MadaraDeadObjectException; import ai.madara.knowledge.KnowledgeBase; import ai.madara.transport.QoSTransportSettings; import ai.madara.transport.TransportType; public class TestMultiController { static private class ControllerThread extends Thread { KnowledgeBase knowledge; BaseController controller; int id; int processes; double hertz; double length; public ControllerThread(int tid, int tprocesses, double thertz, double tlength, boolean networked) throws MadaraDeadObjectException, GamsDeadObjectException { if (networked) { QoSTransportSettings settings = new QoSTransportSettings(); settings.setHosts(new String[] { "239.255.0.1:4150" }); settings.setType(TransportType.MULTICAST_TRANSPORT); knowledge = new KnowledgeBase("", settings); } else { knowledge = new KnowledgeBase(); } controller = new BaseController(knowledge); id = tid; processes = tprocesses; hertz = thertz; length = tlength; System.out.println("Initializing vars in controller " + id + "..."); controller.initVars((long) id, (long) processes); controller.initPlatform(new DebuggerPlatform()); controller.initAlgorithm(new DebuggerAlgorithm()); } public void run() { try { System.out.println("Running controller " + id + " at " + hertz + "hz for " + length + "s..."); controller.runHz(hertz, length, -1); System.out.println("Finished running controller " + id + "..."); System.out.println("Printing controller " + id + "'s knowledge..."); knowledge.print(); controller.free(); knowledge.free(); } catch (Exception e) { e.printStackTrace(); } } } public static void main(String... args) throws Exception { int numControllers = 1; double hertz = 50; double length = 120; boolean networked = false; if (args.length > 0) { try { numControllers = Integer.parseInt(args[0]); } catch (NumberFormatException e) { System.err.println("Argument 1 (" + args[0] + ") is supposed to be number of controllers to run."); System.exit(1); } try { hertz = Double.parseDouble(args[1]); } catch (NumberFormatException e) { System.err.println("Argument 2 (" + args[1] + ") is supposed to be the hertz rate."); System.exit(1); } try { length = Double.parseDouble(args[2]); } catch (NumberFormatException e) { System.err.println("Argument 3 (" + args[2] + ") is supposed to be the length in seconds."); System.exit(1); } if (args.length >= 4) { if (args[3].equalsIgnoreCase("yes")) { networked = true; } } } else { System.err.println("Test takes four arguments: num_controls hertz length [networking?]"); System.err.println(" num_controls specifies the number of controllers"); System.err.println(" hertz specifies the hertz rate to run at"); System.err.println(" length specifies the time in seconds to run"); System.err.println(" networking is optional. By default the controllers" + " are not networked. Any variation of yes will enable networking."); System.exit(1); } if (!networked) { System.out.println("Creating " + numControllers + " base controllers..."); } else { System.out.println("Creating " + numControllers + " networked base controllers..."); } ControllerThread[] controllers = new ControllerThread[numControllers]; for (int i = 0; i < numControllers; ++i) { controllers[i] = new ControllerThread(i, numControllers, hertz, length, networked); } System.out.println("Starting " + numControllers + " base controllers..."); for (int i = 0; i < numControllers; ++i) { controllers[i].start(); } System.out.println("Waiting on " + numControllers + " base controllers..."); for (int i = 0; i < numControllers; ++i) { controllers[i].join(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/tests/TestUtility.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author Anton Dukeman <anton.dukeman@gmail.com> *********************************************************************/ package ai.gams.tests; import ai.gams.exceptions.GamsDeadObjectException; import ai.gams.utility.GpsPosition; public class TestUtility { public static void testRegion() throws GamsDeadObjectException { ai.madara.knowledge.KnowledgeBase kb = new ai.madara.knowledge.KnowledgeBase(); ai.gams.utility.Region reg1 = new ai.gams.utility.Region(); ai.gams.utility.Region reg2 = new ai.gams.utility.Region(); reg1.addVertex(new GpsPosition(0,0,0)); reg1.addVertex(new GpsPosition(0,4,0)); reg1.addVertex(new GpsPosition(3,0,0)); reg1.toContainer(kb, "test"); reg2.fromContainer(kb, "test"); System.err.println(kb.toString()); System.err.println("reg1: "); System.err.println(reg1.toString()); System.err.println(); System.err.println("reg2: "); System.err.println(reg2.toString()); } public static void testPrioritizedRegion() throws GamsDeadObjectException { ai.madara.knowledge.KnowledgeBase kb = new ai.madara.knowledge.KnowledgeBase(); ai.gams.utility.PrioritizedRegion reg1 = new ai.gams.utility.PrioritizedRegion(); ai.gams.utility.PrioritizedRegion reg2 = new ai.gams.utility.PrioritizedRegion(); reg1.addVertex(new GpsPosition(0,0,0)); reg1.addVertex(new GpsPosition(0,4,0)); reg1.addVertex(new GpsPosition(3,0,0)); reg1.setPriority(5); reg1.toContainer(kb, "test"); reg2.fromContainer(kb, "test"); System.err.println(kb.toString()); System.err.println("reg1: "); System.err.println(reg1.toString()); System.err.println(); System.err.println("reg2: "); System.err.println(reg2.toString()); } public static void main (String[] args) throws GamsDeadObjectException { testRegion(); System.err.println(); testPrioritizedRegion(); } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/utility/Axes.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.utility; import ai.gams.GamsJNI; /** * Axes of a device/agent **/ public class Axes extends GamsJNI { private native long jni_Axes(); private native long jni_Axes(long cptr); private native long jni_Axes(double inx, double iny, double inz); private static native void jni_freeAxes(long cptr); private native java.lang.String jni_toString(long cptr); private native double jni_getX(long cptr); private native double jni_getY(long cptr); private native double jni_getZ(long cptr); private native void jni_setX(long cptr, double input); private native void jni_setY(long cptr, double input); private native void jni_setZ(long cptr, double input); private boolean manageMemory = true; /** * Default constructor **/ public Axes() { setCPtr(jni_Axes()); } /** * Constructor for a provided x,y,z coordinate * @param inx the x coordinate * @param iny the y coordinate * @param inz the z coordinate **/ public Axes(double inx, double iny, double inz) { setCPtr(jni_Axes(inx,iny,inz)); } /** * Copy constructor * @param input the Axes to copy **/ public Axes(Axes input) { setCPtr(jni_Axes(input.getCPtr())); } /** * Checks two instances for equality * @param other other Axes to check against * @return true if equal, false otherwise **/ public boolean equals (Axes other) { return getX() == other.getX() && getY() == other.getY() && getZ() == other.getZ(); } /** * Gets a unique hashcode for this instance * @return hashcode for this object instance **/ @Override public int hashCode() { return (int)getCPtr(); } /** * Converts the Axes into a string * @return Axes as a string **/ public java.lang.String toString() { String result = ""; result += getX(); result += ","; result += getY(); result += ","; result += getZ(); return result; } /** * Returns the latitude * @return latitude **/ public double getX() { return jni_getX(getCPtr()); } /** * Returns the longitude * @return longitude **/ public double getY() { return jni_getY(getCPtr()); } /** * Returns the altitude * @return altitude **/ public double getZ() { return jni_getZ(getCPtr()); } /** * Sets the latitude/x coord * @param input the new coord **/ public void setX(double input) { jni_setX(getCPtr(),input); } /** * Sets the longitude/y coord * @param input the new coord **/ public void setY(double input) { jni_setY(getCPtr(),input); } /** * Sets the altitude/z coord * @param input the new coord **/ public void setZ(double input) { jni_setZ(getCPtr(),input); } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static Axes fromPointer(long cptr) { Axes ret = new Axes(); ret.manageMemory = true; ret.setCPtr(cptr); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static Axes fromPointer(long cptr, boolean shouldManage) { Axes ret = new Axes(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); return ret; } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance of WaitSettings gets garbage collected */ public void free() { if(manageMemory) { jni_freeAxes(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/utility/GpsPosition.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.utility; import ai.gams.exceptions.GamsDeadObjectException; public class GpsPosition extends Position { private native long jni_GpsPosition() throws GamsDeadObjectException; private native long jni_GpsPosition(long cptr) throws GamsDeadObjectException; private native long jni_GpsPosition(double lat, double lon, double alt) throws GamsDeadObjectException; private static native void jni_freeGpsPosition(long cptr) throws GamsDeadObjectException; private native java.lang.String jni_toString(long cptr) throws GamsDeadObjectException; private native double jni_getLatitude(long cptr) throws GamsDeadObjectException; private native double jni_getLongitude(long cptr) throws GamsDeadObjectException; private native double jni_getAltitude(long cptr) throws GamsDeadObjectException; private native void jni_setLatitude(long cptr, double input) throws GamsDeadObjectException; private native void jni_setLongitude(long cptr, double input) throws GamsDeadObjectException; private native void jni_setAltitude(long cptr, double input) throws GamsDeadObjectException; private boolean manageMemory = true; public GpsPosition() throws GamsDeadObjectException { setCPtr(jni_GpsPosition()); } public GpsPosition(double lat, double lon, double alt) throws GamsDeadObjectException { setCPtr(jni_GpsPosition(lat,lon,alt)); } public GpsPosition(Position input) throws GamsDeadObjectException { setCPtr(jni_GpsPosition(input.getCPtr())); } /** * Converts the position into a string * @return position as a string **/ public java.lang.String toString() { String result = ""; try{ result += getLatitude(); result += ","; result += getLongitude(); result += ","; result += getAltitude(); }catch(Exception e){ e.printStackTrace(); } return result; } /** * Returns the latitude * @return latitude * @throws GamsDeadObjectException **/ public double getLatitude() throws GamsDeadObjectException { return jni_getLatitude(getCPtr()); } /** * Returns the longitude * @return longitude **/ public double getLongitude() throws GamsDeadObjectException { return jni_getLongitude(getCPtr()); } /** * Returns the altitude * @return altitude **/ public double getAltitude() throws GamsDeadObjectException { return jni_getAltitude(getCPtr()); } /** * Sets the latitude * @param input the new latitude **/ public void setLatitude(double input) throws GamsDeadObjectException { jni_setLatitude(getCPtr(),input); } /** * Sets the longitude * @param input the new longitude **/ public void setLongitude(double input) throws GamsDeadObjectException { jni_setLongitude(getCPtr(),input); } /** * Sets the altitude * @param input the new altitude **/ public void setAltitude(double input) throws GamsDeadObjectException { jni_setAltitude(getCPtr(),input); } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static GpsPosition fromPointer(long cptr) throws GamsDeadObjectException { GpsPosition ret = new GpsPosition(); ret.manageMemory = true; ret.setCPtr(cptr); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static GpsPosition fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { GpsPosition ret = new GpsPosition(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); return ret; } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance of WaitSettings gets garbage collected */ public void free() throws GamsDeadObjectException { if(manageMemory) { jni_freeGpsPosition(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/utility/Logging.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.utility; import ai.gams.GamsJNI; public abstract class Logging extends GamsJNI { private static native void jni_set_level(int level); private static native int jni_get_level(); public enum LogLevel { LOG_NOTHING (-1), LOG_EMERGENCY (0), LOG_ALWAYS (0), LOG_ERROR (1), LOG_WARNING (2), LOG_MAJOR (3), LOG_MINOR (4), LOG_TRACE (5), LOG_DETAILED (6), LOG_MAX (6); private int value; private LogLevel (int v) { value = v; } } public static void setLevel(LogLevel level) { setLevel(level.value); } public static void setLevel(int level) { jni_set_level(level); } public static int getLevel() { return jni_get_level(); } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/utility/Position.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.utility; import ai.gams.GamsJNI; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.exceptions.MadaraDeadObjectException; import ai.madara.knowledge.containers.NativeDoubleVector; /** * Position of a device/agent **/ public class Position extends GamsJNI { private native long jni_Position(); private native long jni_Position(long cptr); private native long jni_Position(double inx, double iny, double inz); private static native void jni_freePosition(long cptr); private native java.lang.String jni_toString(long cptr); private native double jni_getX(long cptr); private native double jni_getY(long cptr); private native double jni_getZ(long cptr); private native void jni_setX(long cptr, double input); private native void jni_setY(long cptr, double input); private native void jni_setZ(long cptr, double input); private boolean manageMemory = true; /** * Default constructor **/ public Position() { setCPtr(jni_Position()); } /** * Constructor for a provided x,y,z coordinate * @param inx the x coordinate * @param iny the y coordinate * @param inz the z coordinate **/ public Position(double inx, double iny, double inz) { setCPtr(jni_Position(inx,iny,inz)); } /** * Constructor from container * @param cont Container to copy from * @throws MadaraDeadObjectException **/ public Position(NativeDoubleVector cont) throws GamsDeadObjectException, MadaraDeadObjectException { fromContainer(cont); } /** * Copy constructor * @param input the position to copy **/ public Position(Position input) { setCPtr(jni_Position(input.getCPtr())); } /** * Checks two instances for equality * @param other other position to check against * @return true if equal, false otherwise * @throws GamsDeadObjectException **/ public boolean equals (Position other) throws GamsDeadObjectException { return getX() == other.getX() && getY() == other.getY() && getZ() == other.getZ(); } /** * Gets a unique hashcode for this instance * @return hashcode for this object instance **/ @Override public int hashCode() { return (int)getCPtr(); } /** * Converts the position into a string * @return position as a string **/ public java.lang.String toString() { String result = ""; try{ result += getX(); result += ","; result += getY(); result += ","; result += getZ(); }catch(GamsDeadObjectException e){ e.printStackTrace(); } return result; } /** * Returns the latitude * @return latitude **/ public double getX() throws GamsDeadObjectException { return jni_getX(getCPtr()); } /** * Returns the longitude * @return longitude **/ public double getY() throws GamsDeadObjectException { return jni_getY(getCPtr()); } /** * Returns the altitude * @return altitude **/ public double getZ() throws GamsDeadObjectException { return jni_getZ(getCPtr()); } /** * Sets the latitude/x coord * @param input the new coord **/ public void setX(double input) throws GamsDeadObjectException { jni_setX(getCPtr(),input); } /** * Sets the longitude/y coord * @param input the new coord **/ public void setY(double input) throws GamsDeadObjectException { jni_setY(getCPtr(),input); } /** * Sets the altitude/z coord * @param input the new coord **/ public void setZ(double input) throws GamsDeadObjectException { jni_setZ(getCPtr(),input); } /** * Get double array representation of Position * @return double array representing this **/ public double[] toArray() throws GamsDeadObjectException { double[] retVal = new double[3]; retVal[0] = getX(); retVal[1] = getY(); retVal[2] = getZ(); return retVal; } /** * Copy values from Array. Does nothing if arr has fewer than 2 elements * @param arr Array to copy **/ public void fromArray(double[] arr) throws GamsDeadObjectException { if(arr.length >= 2) { setX(arr[0]); setY(arr[1]); if(arr.length>= 3) setZ(arr[2]); else setZ(0.0); } } /** * Copy values to a container * @param cont Container to copy values to * @throws GamsDeadObjectException **/ public void toContainer(NativeDoubleVector cont) throws MadaraDeadObjectException, GamsDeadObjectException { cont.set(0, getX()); cont.set(1, getY()); cont.set(2, getZ()); } /** * Copy values from a container * * @param cont Container to copy values from * @throws GamsDeadObjectException */ public void fromContainer(NativeDoubleVector cont) throws MadaraDeadObjectException, GamsDeadObjectException { if(cont.size() >= 2) { setX(cont.get(0)); setY(cont.get(1)); if(cont.size() >= 3) setZ(cont.get(2)); else setZ(0.0); } } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static Position fromPointer(long cptr) throws GamsDeadObjectException { Position ret = new Position(); ret.manageMemory = true; ret.setCPtr(cptr); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static Position fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { Position ret = new Position(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); return ret; } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance of WaitSettings gets garbage collected * @throws GamsDeadObjectException */ public void free() throws GamsDeadObjectException { if(manageMemory) { jni_freePosition(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/utility/PrioritizedRegion.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.utility; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.knowledge.KnowledgeBase; /** * A utility class that acts as a facade for a region **/ public class PrioritizedRegion extends Region { private native long jni_PrioritizedRegion(); private native String jni_toString(long cptr); private native void jni_fromContainer(long cptr, long kb, String name); private native void jni_toContainer(long cptr, long kb, String name); private native void jni_modify(long cptr); private static native void jni_freePrioritizedRegion(long cptr); private native long jni_getPriority(long cptr); private native void jni_setPriority(long cptr, long priority); private boolean manageMemory = true; /** * Default constructor **/ public PrioritizedRegion() throws GamsDeadObjectException { setCPtr(jni_PrioritizedRegion()); } /** * Get String representation of the PrioritizedRegion * @return String representation of this PrioritizedRegion **/ public String toString() { return jni_toString(getCPtr()); } /** * Gets the priority of the region * @return priority of the region **/ public long getPriority() throws GamsDeadObjectException { return jni_getPriority(getCPtr()); } /** * Sets the priority of the region * @param priority the priority of the region **/ public void setPriority(long priority) throws GamsDeadObjectException { jni_setPriority(getCPtr(),priority); } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static PrioritizedRegion fromPointer(long cptr) throws GamsDeadObjectException { PrioritizedRegion ret = new PrioritizedRegion(); ret.manageMemory = true; ret.setCPtr(cptr); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static PrioritizedRegion fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { PrioritizedRegion ret = new PrioritizedRegion(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); return ret; } /** * Helper function for copying values from a MADARA knowledge base * @param kb KnowledgeBase to copy region infomration to **/ public void fromContainer(ai.madara.knowledge.KnowledgeBase kb) throws GamsDeadObjectException { fromContainer(kb, getName()); } /** * Helper function for copying values from a MADARA knowledge base * @param kb KnowledgeBase to copy region infomration to * @param name name of the prioritized region **/ public void fromContainer(KnowledgeBase kb, String name) throws GamsDeadObjectException { jni_fromContainer(getCPtr(), kb.getCPtr(), name); } /** * Helper function for copying values to a MADARA knowledge base * @param kb KnowledgeBase with region information **/ public void toContainer(KnowledgeBase kb) throws GamsDeadObjectException { toContainer(kb, getName()); } /** * Helper function for copying values to a MADARA knowledge base * @param kb KnowledgeBase with region information * @param name name of the prioritized region **/ public void toContainer(KnowledgeBase kb, String name) throws GamsDeadObjectException { jni_toContainer(getCPtr(), kb.getCPtr(), name); } /** * Resends Prioritized_Region over KB **/ public void modify() { jni_modify(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance of WaitSettings gets garbage collected */ public void free() { if(manageMemory) { jni_freePrioritizedRegion(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/utility/Region.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.utility; import ai.gams.GamsJNI; import ai.gams.exceptions.GamsDeadObjectException; /** * A utility class that acts as a facade for a region **/ public class Region extends GamsJNI { private native long jni_Region(); private static native void jni_freeRegion(long cptr); private native String jni_getName(long cptr); private native void jni_setName(long cptr, String name); private native void jni_fromContainer(long cptr, long kb, String name); private native void jni_toContainer(long cptr, long kb, String name); private native void jni_modify(long cptr); private native java.lang.String jni_toString(long cptr); private native void jni_addGpsVertex(long cptr, long coord); private native long[] jni_getVertices(long cptr); private native double jni_getArea(long cptr); private native long jni_getBoundingBox(long cptr); private native boolean jni_containsGps(long cptr, long coord); private native double jni_getGpsDistance(long cptr, long coord); private native double jni_getMaxAlt(long cptr); private native double jni_getMinAlt(long cptr); private native double jni_getMaxLat(long cptr); private native double jni_getMinLat(long cptr); private native double jni_getMaxLong(long cptr); private native double jni_getMinLong(long cptr); private boolean manageMemory = true; /** * Default constructor **/ public Region() { setCPtr(jni_Region()); } /** * Converts the position into a string * * @return position as a string **/ public java.lang.String toString() { return jni_toString(getCPtr()); } /** * Get name of the region * * @return name of the region **/ public String getName() throws GamsDeadObjectException { return jni_getName(getCPtr()); } /** * Set name of the region * * @param n * new name of the region **/ public void setName(String n) throws GamsDeadObjectException { jni_setName(getCPtr(), n); } /** * Adds a GPS vertex to this region * * @param point * point to check **/ public void addVertex(GpsPosition point) throws GamsDeadObjectException { jni_addGpsVertex(getCPtr(), point.getCPtr()); } /** * Gets area of the region * * @return area of this region **/ public double getArea() throws GamsDeadObjectException { return jni_getArea(getCPtr()); } /** * Gets bounding box * * @return Region object corresponding to bounding box **/ public Region getBoundingBox() throws GamsDeadObjectException { Region result = new Region(); result.setCPtr(jni_getBoundingBox(getCPtr())); return result; } /** * Checks to see if the point is contained in this region * * @param point * point to check * @return 0 if in region, otherwise distance from region **/ public boolean contains(GpsPosition point) throws GamsDeadObjectException { return jni_containsGps(getCPtr(), point.getCPtr()); } /** * Get distance from any point in this region * * @param point * point to check * @return 0 if in region, otherwise distance from region **/ public double getDistance(GpsPosition point) throws GamsDeadObjectException { return jni_getGpsDistance(getCPtr(), point.getCPtr()); } /** * Gets the GPS vertices that form the region boundary * * @return vertices that form the region boundary **/ public GpsPosition[] getVertices() throws GamsDeadObjectException { long[] vertices = jni_getVertices(getCPtr()); GpsPosition[] result = new GpsPosition[vertices.length]; if (vertices.length > 0) { result = new GpsPosition[vertices.length]; for (int i = 0; i < vertices.length; ++i) result[i].fromPointer(vertices[i]); } return result; } /** * Gets the maximum altitude * * @return maximum altitude in the region **/ public double getMaxAlt() throws GamsDeadObjectException { return jni_getMaxAlt(getCPtr()); } /** * Gets the minimum altitude * * @return minimum altitude in the region **/ public double getMinAlt() throws GamsDeadObjectException { return jni_getMinAlt(getCPtr()); } /** * Gets the maximum latitude * * @return maximum latitude in the region **/ public double getMaxLat() throws GamsDeadObjectException { return jni_getMaxLat(getCPtr()); } /** * Gets the minimum latitude * * @return minimum latitude in the region **/ public double getMinLat() throws GamsDeadObjectException { return jni_getMinLat(getCPtr()); } /** * Gets the maximum longitude * * @return maximum longitude in the region **/ public double getMaxLong() throws GamsDeadObjectException { return jni_getMaxLong(getCPtr()); } /** * Gets the minimum longitude * * @return minimum longitude in the region **/ public double getMinLong() throws GamsDeadObjectException { return jni_getMinLong(getCPtr()); } /** * Creates a java object instance from a C/C++ pointer * * @param cptr * C pointer to the object * @return a new java instance of the underlying pointer */ public static Region fromPointer(long cptr) throws GamsDeadObjectException { Region ret = new Region(); ret.manageMemory = true; ret.setCPtr(cptr); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr * C pointer to the object * @param shouldManage * if true, manage the pointer * @return a new java instance of the underlying pointer */ public static Region fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { Region ret = new Region(); ret.manageMemory = shouldManage; ret.setCPtr(cptr); return ret; } /** * Helper function for copying values from a MADARA knowledge base * * @param kb * KnowledgeBase to copy region information to **/ public void fromContainer(ai.madara.knowledge.KnowledgeBase kb) throws GamsDeadObjectException { fromContainer(kb, getName()); } /** * Helper function for copying values from a MADARA knowledge base * * @param kb * KnowledgeBase to copy region information to * @param name * name of the region **/ public void fromContainer(ai.madara.knowledge.KnowledgeBase kb, String name) throws GamsDeadObjectException { jni_fromContainer(getCPtr(), kb.getCPtr(), name); } /** * Helper function for copying values to a MADARA knowledge base * * @param kb * KnowledgeBase with region information **/ public void toContainer(ai.madara.knowledge.KnowledgeBase kb) throws GamsDeadObjectException { toContainer(kb, getName()); } /** * Helper function for copying values to a MADARA knowledge base * * @param kb * KnowledgeBase with region information * @param name * name of the region **/ public void toContainer(ai.madara.knowledge.KnowledgeBase kb, String name) throws GamsDeadObjectException { jni_toContainer(getCPtr(), kb.getCPtr(), name); } /** * Calls toContainer with previous values **/ public void modify() { jni_modify(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance of WaitSettings gets garbage collected */ public void free() { if (manageMemory) { jni_freeRegion(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * * @throws Throwable * necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/utility/SearchArea.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.utility; import ai.gams.GamsJNI; import ai.gams.exceptions.GamsDeadObjectException; /** * A utility class that acts as a facade for a SearchArea **/ public class SearchArea extends GamsJNI { private native long jni_SearchArea(); private native String jni_getName(long cptr); private native void jni_setName(long cptr, String name); private native void jni_fromContainer(long cptr, long kb, String name); private native void jni_toContainer(long cptr, long kb, String name); private native void jni_modify(long cptr); private static native void jni_freeSearchArea(long cptr); private native java.lang.String jni_toString(long cptr); private native void jni_addPrioritizedRegion(long cptr, long region); private native long jni_getConvexHull(long cptr); private native boolean jni_containsGps(long cptr, long coord); private native double jni_getMaxAlt(long cptr); private native double jni_getMinAlt(long cptr); private native double jni_getMaxLat(long cptr); private native double jni_getMinLat(long cptr); private native double jni_getMaxLong(long cptr); private native double jni_getMinLong(long cptr); private native long jni_getGpsPriority(long cptr, long coord); private native long[] jni_getRegions(long cptr); private boolean manageMemory = true; public SearchArea() { setCPtr(jni_SearchArea()); } /** * Get name of the SearchArea * @return name of the SearchArea **/ public String getName() throws GamsDeadObjectException { return jni_getName(getCPtr()); } /** * Set name of the SearchArea * @param n new name for SearchArea **/ public void setName(String n) throws GamsDeadObjectException { jni_setName(getCPtr(), n); } /** * Converts the position into a string * @return position as a string **/ public java.lang.String toString() { return jni_toString(getCPtr()); } /** * Adds a region to the search area * @param region the region to add to the search area **/ public void add(PrioritizedRegion region) throws GamsDeadObjectException { jni_addPrioritizedRegion(getCPtr(),region.getCPtr()); } /** * Gets bounding box * @return Region object corresponding to bounding box **/ public Region getConvexHull() throws GamsDeadObjectException { return Region.fromPointer(jni_getConvexHull(getCPtr())); } /** * Checks to see if the point is contained in this region * @param point point to check * @return 0 if in region, otherwise distance from region **/ public boolean contains(GpsPosition point) throws GamsDeadObjectException { return jni_containsGps(getCPtr(),point.getCPtr()); } /** * Gets priority of a gps position * @param point point to check * @return the priority at the point **/ public long getPriority(GpsPosition point) throws GamsDeadObjectException { return jni_getGpsPriority(getCPtr(),point.getCPtr()); } /** * Gets the maximum altitude * @return maximum altitude in the region **/ public double getMaxAlt() throws GamsDeadObjectException { return jni_getMaxAlt(getCPtr()); } /** * Gets the minimum altitude * @return minimum altitude in the region **/ public double getMinAlt() throws GamsDeadObjectException { return jni_getMinAlt(getCPtr()); } /** * Gets the maximum latitude * @return maximum latitude in the region **/ public double getMaxLat() throws GamsDeadObjectException { return jni_getMaxLat(getCPtr()); } /** * Gets the minimum latitude * @return minimum latitude in the region **/ public double getMinLat() throws GamsDeadObjectException { return jni_getMinLat(getCPtr()); } /** * Gets the maximum longitude * @return maximum longitude in the region **/ public double jni_getMaxLong() throws GamsDeadObjectException { return jni_getMaxLong(getCPtr()); } /** * Gets the minimum longitude * @return minimum longitude in the region **/ public double getMinLong() throws GamsDeadObjectException { return jni_getMinLong(getCPtr()); } /** * Gets the regions within the search area * @return vertices that form the region boundary **/ public PrioritizedRegion[] getRegions() throws GamsDeadObjectException { long[] vertices = jni_getRegions(getCPtr()); PrioritizedRegion[] result = new PrioritizedRegion[vertices.length]; if(vertices.length > 0) { result = new PrioritizedRegion[vertices.length]; for (int i = 0; i < vertices.length; ++i) result[i].fromPointer(vertices[i]); } return result; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static SearchArea fromPointer(long cptr) throws GamsDeadObjectException { SearchArea ret = new SearchArea(); ret.manageMemory = true; ret.setCPtr(cptr); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static SearchArea fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { SearchArea ret = new SearchArea(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); return ret; } /** * Helper function for copying values from a MADARA knowledge base * @param kb KnowledgeBase to copy SearchArea information to **/ public void fromContainer(ai.madara.knowledge.KnowledgeBase kb) throws GamsDeadObjectException { fromContainer (kb, getName()); } /** * Helper function for copying values from a MADARA knowledge base * @param kb KnowledgeBase to copy SearchArea information to * @param name name of the SearchArea **/ public void fromContainer(ai.madara.knowledge.KnowledgeBase kb, String name) throws GamsDeadObjectException { jni_fromContainer(getCPtr(), kb.getCPtr(), name); } /** * Helper function for copying values to a MADARA knowledge base * @param kb KnowledgeBase with SearchArea information **/ public void toContainer(ai.madara.knowledge.KnowledgeBase kb) throws GamsDeadObjectException { toContainer(kb, getName()); } /** * Helper function for copying values to a MADARA knowledge base * @param kb KnowledgeBase with SearchArea information * @param name name of the SearchArea **/ public void toContainer(ai.madara.knowledge.KnowledgeBase kb, String name) throws GamsDeadObjectException { jni_toContainer(getCPtr(), kb.getCPtr(), name); } /** * Resend SearchArea over KnowledgeBase **/ public void modify() { jni_modify(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance of WaitSettings gets garbage collected */ public void free() { if(manageMemory) { jni_freeSearchArea(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/variables/AccentStatus.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.variables; import ai.gams.GamsJNI; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.Variables; public class AccentStatus extends GamsJNI { private native long jni_AccentStatus(); private native long jni_AccentStatus(long cptr); private static native void jni_freeAccentStatus(long cptr); private native java.lang.String jni_getName(long cptr); private native void jni_init(long cptr, long type, long kb, java.lang.String name); private native java.lang.String jni_toString(long cptr); private native long jni_getCommand(long cptr); private native long jni_getArgs(long cptr); /** * Default constructor **/ public AccentStatus() throws GamsDeadObjectException { setCPtr(jni_AccentStatus()); init(); } /** * Copy constructor * @param input the accent to copy **/ public AccentStatus(AccentStatus input) throws GamsDeadObjectException { setCPtr(jni_AccentStatus(input.getCPtr())); init(); } /** * Gets the name of the variable * * @return name of the variable within the context */ public java.lang.String getName() throws GamsDeadObjectException { return jni_getName(getCPtr()); } /** * Initializes the member variables **/ public void init() throws GamsDeadObjectException { command = ai.madara.knowledge.containers.String.fromPointer ( jni_getCommand (getCPtr ()),false); args = ai.madara.knowledge.containers.Vector.fromPointer ( jni_getArgs (getCPtr ()),false); } /** * Sets the name and knowledge base being referred to * * @param kb the knowledge base that contains the name * @param name the variable name */ public void init(KnowledgeBase kb, java.lang.String name) throws GamsDeadObjectException { jni_init(getCPtr(), 0, kb.getCPtr (), name); init(); } /** * Sets the name and knowledge base being referred to * * @param vars the variables facade that contains the name * @param name the variable name */ public void init(Variables vars, java.lang.String name) throws GamsDeadObjectException { jni_init(getCPtr(), 1, vars.getCPtr (), name); init(); } /** * The current accent command */ public ai.madara.knowledge.containers.String command; /** * The current accent command arguments */ public ai.madara.knowledge.containers.Vector args; /** * Converts the value to a string * * @return current string value */ public java.lang.String toString() { return jni_toString(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance gets garbage collected */ public void free() { jni_AccentStatus(getCPtr()); setCPtr(0); } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/variables/Agent.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.variables; import ai.gams.GamsJNI; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.Variables; public class Agent extends GamsJNI { private native long jni_Agent(); private native long jni_Agent(long cptr); private static native void jni_freeAgent(long cptr); private native void jni_init(long cptr, long type, long kb, java.lang.String name); private native java.lang.String jni_toString(long cptr); private native long jni_getBatteryRemaining(long cptr); private native long jni_getBridgeId(long cptr); private native long jni_getAlgorithm(long cptr); private native long jni_getAlgorithmArgs(long cptr); private native long jni_getCoverageType(long cptr); private native long jni_getDest(long cptr); private native long jni_getHome(long cptr); private native long jni_getIsMobile(long cptr); private native long jni_getLocation(long cptr); private native long jni_getMinAlt(long cptr); private native long jni_getNextCoverageType(long cptr); private native long jni_getSearchAreaId(long cptr); private native long jni_getSource(long cptr); private native long jni_getTemperature(long cptr); private boolean manageMemory = true; /** * Default constructor **/ public Agent() throws GamsDeadObjectException { setCPtr(jni_Agent()); init(); } /** * Copy constructor * @param input the device to copy **/ public Agent(Agent input) throws GamsDeadObjectException { setCPtr(jni_Agent(input.getCPtr())); init(); } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static Agent fromPointer(long cptr) throws GamsDeadObjectException { Agent ret = new Agent(); ret.manageMemory = true; ret.setCPtr(cptr); ret.init(); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static Agent fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { Agent ret = new Agent(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); ret.init(); return ret; } /** * Initializes the member variables **/ public void init() throws GamsDeadObjectException { batteryRemaining = ai.madara.knowledge.containers.Integer.fromPointer ( jni_getBatteryRemaining (getCPtr ()),false); bridgeId = ai.madara.knowledge.containers.Integer.fromPointer ( jni_getBridgeId (getCPtr ()),false); algorithm = ai.madara.knowledge.containers.String.fromPointer ( jni_getAlgorithm (getCPtr ()),false); algorithmArgs = ai.madara.knowledge.containers.Map.fromPointer ( jni_getAlgorithmArgs (getCPtr ()),false); coverageType = ai.madara.knowledge.containers.String.fromPointer ( jni_getCoverageType (getCPtr ()),false); dest = ai.madara.knowledge.containers.NativeDoubleVector.fromPointer ( jni_getDest (getCPtr ()),false); home = ai.madara.knowledge.containers.NativeDoubleVector.fromPointer ( jni_getHome (getCPtr ()),false); isMobile = ai.madara.knowledge.containers.Integer.fromPointer ( jni_getIsMobile (getCPtr ()),false); location = ai.madara.knowledge.containers.NativeDoubleVector.fromPointer ( jni_getLocation (getCPtr ()),false); minAlt = ai.madara.knowledge.containers.Double.fromPointer ( jni_getMinAlt (getCPtr ()),false); nextCoverageType = ai.madara.knowledge.containers.String.fromPointer ( jni_getNextCoverageType (getCPtr ()),false); searchAreaId = ai.madara.knowledge.containers.Integer.fromPointer ( jni_getSearchAreaId (getCPtr ()),false); source = ai.madara.knowledge.containers.NativeDoubleVector.fromPointer ( jni_getSource (getCPtr ()),false); temperature = ai.madara.knowledge.containers.Double.fromPointer ( jni_getTemperature (getCPtr ()),false); } /** * Sets the name and knowledge base being referred to * * @param kb the knowledge base that contains the name * @param name the variable name */ public void init(KnowledgeBase kb, java.lang.String name) throws GamsDeadObjectException { jni_init(getCPtr(), 0, kb.getCPtr (), name); init(); } /** * Sets the name and knowledge base being referred to * * @param vars the variables facade that contains the name * @param name the variable name */ public void init(Variables vars, java.lang.String name) throws GamsDeadObjectException { jni_init(getCPtr(), 1, vars.getCPtr (), name); init(); } /** * The current device command */ public ai.madara.knowledge.containers.Integer batteryRemaining; /** * The current device bridge id */ public ai.madara.knowledge.containers.Integer bridgeId; /** * The current device command */ public ai.madara.knowledge.containers.String algorithm; /** * The current device command args */ public ai.madara.knowledge.containers.Map algorithmArgs; /** * The current device coverage type */ public ai.madara.knowledge.containers.String coverageType; /** * The current device destination location */ public ai.madara.knowledge.containers.NativeDoubleVector dest; /** * The current device home location */ public ai.madara.knowledge.containers.NativeDoubleVector home; /** * Flag for if current device is mobile */ public ai.madara.knowledge.containers.Integer isMobile; /** * The current device current location */ public ai.madara.knowledge.containers.NativeDoubleVector location; /** * Flag for if current device is mobile */ public ai.madara.knowledge.containers.Double minAlt; /** * The current device's next coverage type */ public ai.madara.knowledge.containers.String nextCoverageType; /** * The current device search area id */ public ai.madara.knowledge.containers.Integer searchAreaId; /** * The current device home source location */ public ai.madara.knowledge.containers.NativeDoubleVector source; /** * The current device temperature */ public ai.madara.knowledge.containers.Double temperature; /** * Converts the value to a string * * @return current string value */ public java.lang.String toString() { return jni_toString(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance gets garbage collected */ public void free() { if (manageMemory) { jni_freeAgent(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/variables/Agents.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.variables; import java.util.AbstractList; import ai.gams.exceptions.GamsDeadObjectException; /** * Agents provides a read-only interface for agents */ public class Agents extends AbstractList<Agent> { private native void jni_freeAgents(long[] records, int length); private long[] agents; /** * Constructor * * @param input * list of C pointers to the underlying agents **/ public Agents(long[] input) { agents = input; } /** * Gets the agent at the specified index * * @see java.util.AbstractList#get (int) * @param index * the element of the agent list to retrieve */ @Override public Agent get(int index) { try { return Agent.fromPointer(agents[index]); } catch (GamsDeadObjectException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } /** * Returns the size of the agent list * * @see java.util.AbstractCollection#size () * @return the size of the agent list */ @Override public int size() { return agents == null ? 0 : agents.length; } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance gets garbage collected */ public void free() { if (agents == null) return; jni_freeAgents(agents, agents.length); agents = null; } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/variables/AlgorithmStatus.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.variables; import ai.gams.GamsJNI; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.Variables; import ai.madara.knowledge.containers.Integer; public class AlgorithmStatus extends GamsJNI { private native long jni_AlgorithmStatus(); private native long jni_AlgorithmStatus(long cptr); private static native void jni_freeAlgorithmStatus(long cptr); private native java.lang.String jni_getName(long cptr); private native void jni_init(long cptr, long type, long kb, java.lang.String name, int id); private native java.lang.String jni_toString(long cptr); private native long jni_getDeadlocked(long cptr); private native long jni_getFailed(long cptr); private native long jni_getOk(long cptr); private native long jni_getPaused(long cptr); private native long jni_getUnknown(long cptr); private native long jni_getWaiting(long cptr); private native long jni_getFinished(long cptr); private boolean manageMemory = true; /** * Default constructor **/ public AlgorithmStatus() throws GamsDeadObjectException { setCPtr(jni_AlgorithmStatus()); init(); } /** * Copy constructor * @param input the algorithm to copy **/ public AlgorithmStatus(AlgorithmStatus input) throws GamsDeadObjectException { setCPtr(jni_AlgorithmStatus(input.getCPtr())); init(); } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static AlgorithmStatus fromPointer(long cptr) throws GamsDeadObjectException { AlgorithmStatus ret = new AlgorithmStatus(); ret.manageMemory = true; ret.setCPtr(cptr); ret.init(); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static AlgorithmStatus fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { AlgorithmStatus ret = new AlgorithmStatus(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); ret.init(); return ret; } /** * Gets the name of the variable * * @return name of the variable within the context */ public java.lang.String getName() throws GamsDeadObjectException { return jni_getName(getCPtr()); } /** * Initializes the member variables **/ public void init() throws GamsDeadObjectException { deadlocked = Integer.fromPointer (jni_getDeadlocked (getCPtr ()), false); failed = Integer.fromPointer (jni_getFailed (getCPtr ()), false); ok = Integer.fromPointer (jni_getOk (getCPtr ()), false); paused = Integer.fromPointer (jni_getPaused (getCPtr ()), false); unknown = Integer.fromPointer (jni_getUnknown (getCPtr ()), false); waiting = Integer.fromPointer (jni_getWaiting (getCPtr ()), false); finished = Integer.fromPointer (jni_getFinished (getCPtr ()), false); } /** * Sets the name and knowledge base being referred to * * @param kb the knowledge base that contains the name * @param name the variable name * @param id id of the agent to get status for */ public void init(KnowledgeBase kb, java.lang.String name, int id) throws GamsDeadObjectException { jni_init(getCPtr(), 0, kb.getCPtr (), name, id); init(); } /** * Sets the name and knowledge base being referred to * * @param vars the variables facade that contains the name * @param name the variable name * @param id id of the agent to get status for */ public void init(Variables vars, java.lang.String name, int id) throws GamsDeadObjectException { jni_init(getCPtr(), 1, vars.getCPtr (), name, id); init(); } /** * Flag for whether the algorithm is deadlocked or not */ public ai.madara.knowledge.containers.Integer deadlocked; /** * Flag for whether the algorithm is failed or not */ public ai.madara.knowledge.containers.Integer failed; /** * Flag for whether the algorithm is ok or not */ public ai.madara.knowledge.containers.Integer ok; /** * Flag for whether the algorithm is paused or not */ public ai.madara.knowledge.containers.Integer paused; /** * Flag for whether the algorithm is in an unknown state or not */ public ai.madara.knowledge.containers.Integer unknown; /** * Flag for whether the algorithm is in a waiting state or not */ public ai.madara.knowledge.containers.Integer waiting; /** * Flag for whether the algorithm is finished */ public ai.madara.knowledge.containers.Integer finished; /** * Converts the value to a string * * @return current string value */ public java.lang.String toString() { return jni_toString(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance gets garbage collected */ public void free() { if (manageMemory) { jni_freeAlgorithmStatus(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/variables/PlatformStatus.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.variables; import ai.gams.GamsJNI; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.Variables; import ai.madara.knowledge.containers.Integer; public class PlatformStatus extends GamsJNI { private native long jni_PlatformStatus(); private native long jni_PlatformStatus(long cptr); private static native void jni_freePlatformStatus(long cptr); private native java.lang.String jni_getName(long cptr); private native void jni_init(long cptr, long type, long kb, java.lang.String name); private native java.lang.String jni_toString(long cptr); private native long jni_getCommunicationAvailable(long cptr); private native long jni_getDeadlocked(long cptr); private native long jni_getFailed(long cptr); private native long jni_getGpsSpoofed(long cptr); private native long jni_getMovementAvailable(long cptr); private native long jni_getMoving(long cptr); private native long jni_getOk(long cptr); private native long jni_getPausedMoving(long cptr); private native long jni_getReducedSensing(long cptr); private native long jni_getReducedMovement(long cptr); private native long jni_getSensorsAvailable(long cptr); private native long jni_getWaiting(long cptr); private boolean manageMemory = true; /** * Default constructor **/ public PlatformStatus() throws GamsDeadObjectException { setCPtr(jni_PlatformStatus()); init(); } /** * Copy constructor * @param input the platform to copy **/ public PlatformStatus(PlatformStatus input) throws GamsDeadObjectException { setCPtr(jni_PlatformStatus(input.getCPtr())); init(); } /** * Gets the name of the variable * * @return name of the variable within the context */ public java.lang.String getName() throws GamsDeadObjectException { return jni_getName(getCPtr()); } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static PlatformStatus fromPointer(long cptr) throws GamsDeadObjectException { PlatformStatus ret = new PlatformStatus(); ret.manageMemory = true; ret.setCPtr(cptr); ret.init(); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static PlatformStatus fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { PlatformStatus ret = new PlatformStatus(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); ret.init(); return ret; } /** * Initializes the member variables **/ public void init() throws GamsDeadObjectException { communicationAvailable = Integer.fromPointer ( jni_getCommunicationAvailable (getCPtr ()),false); deadlocked = Integer.fromPointer ( jni_getDeadlocked (getCPtr ()),false); failed = Integer.fromPointer ( jni_getFailed (getCPtr ()),false); gpsSpoofed = Integer.fromPointer ( jni_getGpsSpoofed (getCPtr ()),false); movementAvailable = Integer.fromPointer ( jni_getMovementAvailable (getCPtr ()),false); moving = Integer.fromPointer ( jni_getMoving (getCPtr ()),false); ok = Integer.fromPointer ( jni_getOk (getCPtr ()),false); pausedMoving = Integer.fromPointer ( jni_getPausedMoving (getCPtr ()),false); reducedSensing = Integer.fromPointer ( jni_getReducedSensing (getCPtr ()),false); reducedMovement = Integer.fromPointer ( jni_getReducedMovement (getCPtr ()),false); sensorsAvailable = Integer.fromPointer ( jni_getSensorsAvailable (getCPtr ()),false); waiting = Integer.fromPointer ( jni_getWaiting (getCPtr ()),false); } /** * Sets the name and knowledge base being referred to * * @param kb the knowledge base that contains the name * @param name the variable name */ public void init(KnowledgeBase kb, java.lang.String name) throws GamsDeadObjectException { jni_init(getCPtr(), 0, kb.getCPtr (), name); init(); } /** * Sets the name and knowledge base being referred to * * @param vars the variables facade that contains the name * @param name the variable name */ public void init(Variables vars, java.lang.String name) throws GamsDeadObjectException { jni_init(getCPtr(), 1, vars.getCPtr (), name); init(); } /** * Flag for whether the algorithm is deadlocked or not */ public Integer communicationAvailable; /** * Flag for whether the algorithm is deadlocked or not */ public Integer deadlocked; /** * Flag for whether the algorithm is failed or not */ public Integer failed; /** * Flag for whether the algorithm is failed or not */ public Integer gpsSpoofed; /** * Flag for whether the algorithm is failed or not */ public Integer movementAvailable; /** * Flag for whether the algorithm is failed or not */ public Integer moving; /** * Flag for whether the algorithm is ok or not */ public Integer ok; /** * Flag for whether the algorithm is paused or not */ public Integer pausedMoving; /** * Flag for whether the algorithm is paused or not */ public Integer reducedSensing; /** * Flag for whether the algorithm is paused or not */ public Integer reducedMovement; /** * Flag for whether the algorithm is paused or not */ public Integer sensorsAvailable; /** * Flag for whether the algorithm is in a waiting state or not */ public Integer waiting; /** * Converts the value to a string * * @return current string value */ public java.lang.String toString() { return jni_toString(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance gets garbage collected */ public void free() { if (manageMemory) { jni_freePlatformStatus(getCPtr()); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/variables/Region.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.variables; import ai.gams.GamsJNI; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.Variables; public class Region extends GamsJNI { private native long jni_Region(); private native long jni_Region(long cptr); private static native void jni_freeRegion(long cptr); private native java.lang.String jni_getName(long cptr); private native void jni_init(long cptr, long type, long kb, java.lang.String name); private native java.lang.String jni_toString(long cptr); private native long jni_getVertices(long cptr); /** * Default constructor **/ public Region() { setCPtr(jni_Region()); init(); } /** * Copy constructor * @param input the region to copy **/ public Region(Region input) { setCPtr(jni_Region(input.getCPtr())); init(); } /** * Gets the name of the variable * * @return name of the variable within the context */ public java.lang.String getName() { return jni_getName(getCPtr()); } /** * Initializes the member variables **/ public void init() { vertices = ai.madara.knowledge.containers.Vector.fromPointer ( jni_getVertices (getCPtr ())); } /** * Sets the name and knowledge base being referred to * * @param kb the knowledge base that contains the name * @param name the variable name */ public void init(KnowledgeBase kb, java.lang.String name) { jni_init(getCPtr(), 0, kb.getCPtr (), name); init(); } /** * Sets the name and knowledge base being referred to * * @param vars the variables facade that contains the name * @param name the variable name */ public void init(Variables vars, java.lang.String name) { jni_init(getCPtr(), 1, vars.getCPtr (), name); init(); } /** * The current accent command arguments */ public ai.madara.knowledge.containers.Vector vertices; /** * Converts the value to a string * * @return current string value */ public java.lang.String toString() { return jni_toString(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance of WaitSettings gets garbage collected */ public void free() { jni_freeRegion(getCPtr()); setCPtr(0); } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/variables/Self.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.variables; import ai.gams.GamsJNI; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.Variables; import ai.madara.knowledge.containers.Integer; public class Self extends GamsJNI { private native long jni_Self(); private native long jni_Self(long cptr); private static native void jni_freeSelf(long cptr); private native void jni_init(long cptr, long type, long kb, long name); private native java.lang.String jni_toString(long cptr); private native long jni_getId(long cptr); private native long jni_getAgent(long cptr); private boolean manageMemory = true; /** * Default constructor **/ public Self() throws GamsDeadObjectException { setCPtr(jni_Self()); init(); } /** * Copy constructor * @param input the Self variable to copy **/ public Self(Self input) throws GamsDeadObjectException { setCPtr(jni_Self(input.getCPtr())); init(); } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static Self fromPointer(long cptr) throws GamsDeadObjectException { Self ret = new Self(); ret.manageMemory = true; ret.setCPtr(cptr); ret.init(); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static Self fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { Self ret = new Self(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); ret.init(); return ret; } /** * Initializes the member variables **/ public void init() throws GamsDeadObjectException { id = Integer.fromPointer (jni_getId (getCPtr ()),false); agent = Agent.fromPointer (jni_getAgent (getCPtr ()),false); } /** * Initializes the id and agent containers within Self * * @param kb the knowledge base that contains the agent info * @param id the agent id (0 to n - 1, inclusively) */ public void init(KnowledgeBase kb, long id) throws GamsDeadObjectException { jni_init(getCPtr(), 0, kb.getCPtr (), id); init(); } /** * Initializes the id and agent containers within Self * * @param vars the variables facade that contains the agent info * @param id the agent id (0 to n - 1, inclusively) */ public void init(Variables vars, long id) throws GamsDeadObjectException { jni_init(getCPtr(), 1, vars.getCPtr (), id); init(); } /** * The agent id */ public ai.madara.knowledge.containers.Integer id; /** * The agent-specific variables */ public Agent agent; /** * Converts the value to a string * * @return current string value */ public java.lang.String toString() { return jni_toString(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance gets garbage collected */ public void free() { if (manageMemory) { jni_freeSelf(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/variables/Sensor.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.variables; import java.util.HashSet; import ai.gams.GamsJNI; import ai.gams.exceptions.GamsDeadObjectException; import ai.gams.utility.GpsPosition; import ai.gams.utility.Position; import ai.madara.knowledge.KnowledgeBase; public class Sensor extends GamsJNI { private native long jni_Sensor(); private native long jni_Sensor(long cptr); private static native void jni_freeSensor(long cptr); private native java.lang.String jni_getName(long cptr); private native void jni_init(long cptr, long type, long kb, java.lang.String name, double range); private native java.lang.String jni_toString(long cptr); private native double jni_getPositionValue(long cptr, long pos); private native double jni_getGpsValue(long cptr, long pos); private native long jni_getOrigin(long cptr); private native double jni_getRange(long cptr); private native void jni_setOrigin(long cptr, long origin); private native void jni_setRange(long cptr, double range); private native void jni_setPositionValue(long cptr, long pos, double value); private native void jni_setGpsValue(long cptr, long pos, double value); private native long jni_getGpsFromIndex(long cptr, long index); private native long jni_getIndexFromGps(long cptr, long position); private native double jni_getDiscretization(long cptr); private native long[] jni_discretizeRegion(long cptr, long region); private native long[] jni_discretizeSearchArea(long cptr, long area); private boolean manageMemory = true; /** * Default constructor **/ public Sensor() { setCPtr(jni_Sensor()); } /** * Copy constructor * @param input the sensor value to copy **/ public Sensor(Sensor input) { setCPtr(jni_Sensor(input.getCPtr())); } /** * Gets the sensor range in meters. * @return range in meters **/ public GpsPosition getOrigin() throws GamsDeadObjectException { return GpsPosition.fromPointer (jni_getOrigin(getCPtr())); } /** * Gets the sensor range in meters. * @return range in meters **/ public double getRange() throws GamsDeadObjectException { return jni_getRange(getCPtr()); } /** * Gets a GPS coordinate from an index * @param index the cartesian position * @return the position at the specified index **/ public GpsPosition getGpsFromIndex(Position index) throws GamsDeadObjectException { return GpsPosition.fromPointer( jni_getGpsFromIndex(getCPtr(),index.getCPtr())); } /** * Gets a GPS coordinate from an index * @param coord coordinate to convert to an index * @return the position at the specified index **/ public Position getIndexFromGps(GpsPosition coord) throws GamsDeadObjectException { return Position.fromPointer( jni_getIndexFromGps(getCPtr(),coord.getCPtr())); } /** * Gets the value stored at a particular location * @param position the location to check * @return value at the location **/ public double getValue(GpsPosition position) throws GamsDeadObjectException { return jni_getGpsValue(getCPtr(), position.getCPtr()); } /** * Gets the value stored at a particular location * @param position the location to check * @return value at the location **/ public double getValue(Position position) throws GamsDeadObjectException { return jni_getPositionValue(getCPtr(), position.getCPtr()); } /** * Gets the discretization value for the sensor * @return the discretization value for the sensor **/ public double getDiscretization() throws GamsDeadObjectException { return jni_getDiscretization(getCPtr()); } /** * Sets the range of the sensor * @param range the range of the sensor in meters **/ public void setRange(double range) throws GamsDeadObjectException { jni_setRange(getCPtr(), range); } /** * Sets the origin for coverage information and discretization * @param origin the origin for coverage information **/ public void setOrigin(GpsPosition origin) throws GamsDeadObjectException { jni_setOrigin(getCPtr(), origin.getCPtr()); } /** * Sets a value at a location * @param location the position the value will be at * @param value the value to set **/ public void setValue(Position location, double value) throws GamsDeadObjectException { jni_setPositionValue(getCPtr(), location.getCPtr(), value); } /** * Sets a value at a location * @param location the position the value will be at * @param value the value to set **/ public void setValue(GpsPosition location, double value) throws GamsDeadObjectException { jni_setPositionValue(getCPtr(), location.getCPtr(), value); } /** * Discretizes the region into individual positions * @param region the region to discretize * @return individual positions within the region **/ public HashSet<Position> discretize(ai.gams.utility.Region region) throws GamsDeadObjectException { long[] indices = jni_discretizeRegion(getCPtr(), region.getCPtr()); HashSet<Position> hash = new HashSet<Position> (); for (int i = 0; i < indices.length; ++i) hash.add(Position.fromPointer(indices[i])); return hash; } /** * Discretizes the area into individual positions * @param area the area to discretize * @return individual positions within the area **/ public HashSet<Position> discretize(ai.gams.utility.SearchArea area) throws GamsDeadObjectException { long[] indices = jni_discretizeSearchArea(getCPtr(), area.getCPtr()); HashSet<Position> hash = new HashSet<Position> (); for (int i = 0; i < indices.length; ++i) hash.add(Position.fromPointer(indices[i])); return hash; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static Sensor fromPointer(long cptr) throws GamsDeadObjectException { Sensor ret = new Sensor(); ret.manageMemory = true; ret.setCPtr(cptr); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static Sensor fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { Sensor ret = new Sensor(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); return ret; } /** * Gets the name of the variable * * @return name of the variable within the context */ public java.lang.String getName() throws GamsDeadObjectException { return jni_getName(getCPtr()); } /** * Sets the name and knowledge base being referred to * * @param kb the knowledge base that contains the name * @param name the variable name * @param range the range of the sensor in meters or appropriate unit */ public void init(KnowledgeBase kb, java.lang.String name, double range) throws GamsDeadObjectException { jni_init(getCPtr(), 0, kb.getCPtr (), name, range); } /** * Converts the value to a string * * @return current string value */ public java.lang.String toString() { return jni_toString(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance gets garbage collected */ public void free() { if (manageMemory) { jni_freeSensor(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/variables/SensorMap.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.variables; import java.util.AbstractMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import ai.gams.exceptions.GamsDeadObjectException; public class SensorMap extends AbstractMap<java.lang.String, Sensor> { private native void jni_freeSensorMap(long[] ptrs, int length); private Set<Map.Entry<java.lang.String, Sensor>> mySet; private final boolean freeable; /** * Base constructor for a sensor map * * @param keys * list of keys * @param vals * list of values **/ public SensorMap(java.lang.String[] keys, long[] vals) { this(keys, vals, true); } /** * Constructor for a sensor map * * @param keys * list of keys * @param vals * list of values * @param freeable * if true, indicates that the list is able to be freed **/ public SensorMap(java.lang.String[] keys, long[] vals, boolean freeable) { this.freeable = freeable; if (keys == null || vals == null || keys.length != vals.length) return; mySet = new HashSet<Map.Entry<java.lang.String, Sensor>>(); for (int x = 0; x < keys.length; x++) { mySet.add(new SensorMapEntry(keys[x], vals[x], freeable)); } } /** * Returns an entry set for iteration * * @see java.util.AbstractMap#entrySet () * @return the iterable entry set */ @Override public Set<Map.Entry<java.lang.String, Sensor>> entrySet() { return mySet; } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance of gets garbage collected */ public void free() { if (!freeable) return; long[] ptrs = new long[mySet == null ? 0 : mySet.size()]; int pos = 0; for (Map.Entry<java.lang.String, Sensor> entry : mySet) { ptrs[pos++] = entry.getValue().getCPtr(); } jni_freeSensorMap(ptrs, ptrs.length); mySet = null; } /** * Map entry for iteration of entry set **/ private static class SensorMapEntry implements Map.Entry<java.lang.String, Sensor> { private java.lang.String key; private Sensor record; /** * Can only be called from SensorMap **/ private SensorMapEntry(java.lang.String key, long val, boolean isNew) { this.key = key; try { record = Sensor.fromPointer(val, isNew); } catch (GamsDeadObjectException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Gets the key of the entry * * @see java.util.Map.Entry#getKey () * @return the key */ public java.lang.String getKey() { return key; } /** * Gets the value of the entry * * @see java.util.Map.Entry#getValue () * @return the sensor object (value) */ public Sensor getValue() { return record; } /** * Set value is unsupported. This is a read-only entry. * * @see java.util.Map.Entry#setValue (java.lang.Object) * @param value * the value, if this were settable * @return the value */ public Sensor setValue(Sensor value) { throw new UnsupportedOperationException("This map does not allow modification"); } } }
0
java-sources/ai/gams/gams/1.2.2/ai/gams
java-sources/ai/gams/gams/1.2.2/ai/gams/variables/Swarm.java
/********************************************************************* * Copyright (c) 2013-2015 Carnegie Mellon University. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following acknowledgments and disclaimers. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The names "Carnegie Mellon University," "SEI" and/or * "Software Engineering Institute" shall not be used to endorse or promote * products derived from this software without prior written permission. For * written permission, please contact permission@sei.cmu.edu. * * 4. Products derived from this software may not be called "SEI" nor may "SEI" * appear in their names without prior written permission of * permission@sei.cmu.edu. * * 5. Redistributions of any form whatsoever must retain the following * acknowledgment: * * This material is based upon work funded and supported by the Department of * Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University * for the operation of the Software Engineering Institute, a federally funded * research and development center. Any opinions, findings and conclusions or * recommendations expressed in this material are those of the author(s) and * do not necessarily reflect the views of the United States Department of * Defense. * * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE * MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND * WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. * * This material has been approved for public release and unlimited * distribution. * * @author James Edmondson <jedmondson@gmail.com> *********************************************************************/ package ai.gams.variables; import ai.gams.GamsJNI; import ai.gams.exceptions.GamsDeadObjectException; import ai.madara.knowledge.KnowledgeBase; import ai.madara.knowledge.Variables; public class Swarm extends GamsJNI { private native long jni_Swarm(); private native long jni_Swarm(long cptr); private static native void jni_freeSwarm(long cptr); private native void jni_init(long cptr, long type, long kb, java.lang.String name); private native java.lang.String jni_toString(long cptr); private native long jni_getCommand(long cptr); private native long jni_getArgs(long cptr); private native long jni_getMinAlt(long cptr); private native long jni_getSize(long cptr); private boolean manageMemory = true; /** * Default constructor **/ public Swarm() throws GamsDeadObjectException { setCPtr(jni_Swarm()); init(); } /** * Copy constructor * @param input the swarm object to copy **/ public Swarm(Swarm input) throws GamsDeadObjectException { setCPtr(jni_Swarm(input.getCPtr())); init(); } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @return a new java instance of the underlying pointer */ public static Swarm fromPointer(long cptr) throws GamsDeadObjectException { Swarm ret = new Swarm(); ret.manageMemory = true; ret.setCPtr(cptr); ret.init(); return ret; } /** * Creates a java object instance from a C/C++ pointer * * @param cptr C pointer to the object * @param shouldManage if true, manage the pointer * @return a new java instance of the underlying pointer */ public static Swarm fromPointer(long cptr, boolean shouldManage) throws GamsDeadObjectException { Swarm ret = new Swarm(); ret.manageMemory=shouldManage; ret.setCPtr(cptr); ret.init(); return ret; } /** * Initializes the member variables **/ public void init() throws GamsDeadObjectException { command = ai.madara.knowledge.containers.String.fromPointer ( jni_getCommand (getCPtr ()),false); args = ai.madara.knowledge.containers.Vector.fromPointer ( jni_getArgs (getCPtr ()),false); minAlt = ai.madara.knowledge.containers.Double.fromPointer ( jni_getMinAlt (getCPtr ()),false); size = ai.madara.knowledge.containers.Integer.fromPointer ( jni_getSize (getCPtr ()),false); } /** * Sets the name and knowledge base being referred to * * @param kb the knowledge base that contains the name * @param name the variable name */ public void init(KnowledgeBase kb, java.lang.String name) throws GamsDeadObjectException { jni_init(getCPtr(), 0, kb.getCPtr (), name); init(); } /** * Sets the name and knowledge base being referred to * * @param vars the variables facade that contains the name * @param name the variable name */ public void init(Variables vars, java.lang.String name) throws GamsDeadObjectException { jni_init(getCPtr(), 1, vars.getCPtr (), name); init(); } /** * The current swarm command */ public ai.madara.knowledge.containers.String command; /** * The current swarm command args */ public ai.madara.knowledge.containers.Vector args; /** * The current swarm minimum altitude */ public ai.madara.knowledge.containers.Double minAlt; /** * The current swarm size */ public ai.madara.knowledge.containers.Integer size; /** * Converts the value to a string * * @return current string value */ public java.lang.String toString() { return jni_toString(getCPtr()); } /** * Deletes the C instantiation. To prevent memory leaks, this <b>must</b> be * called before an instance gets garbage collected */ public void free() { if (manageMemory) { jni_freeSwarm(getCPtr()); setCPtr(0); } } /** * Cleans up underlying C resources * @throws Throwable necessary for override but unused */ @Override protected void finalize() throws Throwable { try { free(); } catch (Throwable t) { throw t; } finally { super.finalize(); } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/client/AuthenticationClient.java
package ai.genauth.sdk.java.client; import ai.genauth.sdk.java.dto.*; import ai.genauth.sdk.java.dto.authentication.AccessToken; import ai.genauth.sdk.java.dto.authentication.BuildLogoutUrlParams; import ai.genauth.sdk.java.dto.authentication.CaptchaCodeRespDto; import ai.genauth.sdk.java.dto.authentication.CodeChallengeDigestParam; import ai.genauth.sdk.java.dto.authentication.CodeToTokenParams; import ai.genauth.sdk.java.dto.authentication.ICasParams; import ai.genauth.sdk.java.dto.authentication.IDToken; import ai.genauth.sdk.java.dto.authentication.IOauthParams; import ai.genauth.sdk.java.dto.authentication.IOidcParams; import ai.genauth.sdk.java.dto.authentication.OIDCTokenResponse; import ai.genauth.sdk.java.dto.authentication.UserInfo; import ai.genauth.sdk.java.dto.authentication.ValidateTicketV1Response; import ai.genauth.sdk.java.dto.authentication.ValidateTokenParams; import ai.genauth.sdk.java.enums.AuthMethodEnum; import ai.genauth.sdk.java.enums.ProtocolEnum; import ai.genauth.sdk.java.model.AuthenticationClientOptions; import ai.genauth.sdk.java.model.AuthingRequestConfig; import ai.genauth.sdk.java.model.AuthingWebsocketClient; import ai.genauth.sdk.java.model.ClientCredentialInput; import ai.genauth.sdk.java.model.Receiver; import ai.genauth.sdk.java.util.CommonUtils; import ai.genauth.sdk.java.util.HttpUtils; import cn.hutool.core.codec.Base64Encoder; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.hutool.http.Header; import com.nimbusds.jose.JWSAlgorithm; import com.nimbusds.jose.JWSObject; import com.nimbusds.jose.JWSVerifier; import com.nimbusds.jose.crypto.MACVerifier; import com.nimbusds.jose.crypto.RSASSAVerifier; import com.nimbusds.jose.jwk.JWKSet; import com.nimbusds.jose.jwk.RSAKey; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.nio.charset.Charset; import java.security.InvalidParameterException; import java.security.MessageDigest; import java.text.ParseException; import java.util.Base64; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; /** * @author ZKB */ @SuppressWarnings("all") public class AuthenticationClient extends BaseClient { private final AuthenticationClientOptions options; private final String appId; private JWKSet jwks; public AuthenticationClient(AuthenticationClientOptions options) throws IOException, ParseException { super(options); // 必要参数校验 this.options = options; appId = options.getAppId(); if (!(options.getScope().contains("openid"))) { throw new IllegalArgumentException("scope 中必须包含 openid"); } } public void setAccessToken(String accessToken) { this.options.setAccessToken(accessToken); } private JWKSet fetchJwks() throws IOException, ParseException { if (this.jwks != null) { return this.jwks; } else { JWKSet jwks = JWKSet.load(new URL(this.options.getAppHost() + "/oidc/.well-known/jwks.json")); this.jwks = jwks; return jwks; } } private IDToken parseIDToken(String token) throws Exception { JWSObject jwsObject = JWSObject.parse(token); String payload; if (jwsObject.getHeader().getAlgorithm() == JWSAlgorithm.HS256) { JWSVerifier jwsVerifier = new MACVerifier(this.options.getAppSecret()); if (!jwsObject.verify(jwsVerifier)) { throw new Exception("token 签名不合法"); } } else { RSAKey rsaKey = this.fetchJwks().getKeys().get(0).toRSAKey(); RSASSAVerifier verifier = new RSASSAVerifier(rsaKey); if (!jwsObject.verify(verifier)) { throw new Exception("校验不通过"); } } payload = jwsObject.getPayload().toString(); return deserialize(payload, IDToken.class); } public AccessToken introspectAccessTokenOffline(String token) throws Exception { JWSObject jwsObject = JWSObject.parse(token); String payload; RSAKey rsaKey = this.fetchJwks().getKeys().get(0).toRSAKey(); RSASSAVerifier verifier = new RSASSAVerifier(rsaKey); if (!jwsObject.verify(verifier)) { throw new Exception("校验不通过"); } payload = jwsObject.getPayload().toString(); return deserialize(payload, AccessToken.class); } public OIDCTokenResponse getAccessTokenByCode(String code) throws Exception { return this.getAccessTokenByCode(code, this.options.getRedirectUri()); } public OIDCTokenResponse getAccessTokenByCode(String code, String redirectUri) throws Exception { if ((StrUtil.isBlank(this.options.getAppId()) || StrUtil.isBlank(this.options.getAppSecret())) && this.options.getTokenEndPointAuthMethod() != AuthMethodEnum.NONE.getValue()) { throw new Exception("请在初始化 AuthenticationClient 时传入 appId 和 secret 参数"); } String url = ""; if (this.options.getProtocol() == ProtocolEnum.OAUTH.getValue()) { url += "/oauth/token"; } else { url += "/oidc/token"; } CodeToTokenParams tokenParam = new CodeToTokenParams(); tokenParam.setRedirectUri(redirectUri); tokenParam.setCode(code); tokenParam.setGrantType("authorization_code"); AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl(url); config.setMethod("UrlencodedPOST"); HashMap<String, String> headerMap = new HashMap<>(); headerMap.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); if (this.options.getTokenEndPointAuthMethod() == AuthMethodEnum.CLIENT_SECRET_POST.getValue()) { tokenParam.setClientId(this.options.getAppId()); tokenParam.setClientSecret(this.options.getAppSecret()); } else if (this.options.getTokenEndPointAuthMethod() == AuthMethodEnum.CLIENT_SECRET_BASIC.getValue()) { String basic64Str = "Basic " + Base64.getEncoder() .encodeToString((this.options.getAppId() + ":" + this.options.getAppSecret()).getBytes()); headerMap.put("Authorization", basic64Str); } else { // AuthMethodEnum.NONE tokenParam.setClientId(this.options.getAppId()); } config.setHeaders(headerMap); config.setBody(tokenParam); String response = request(config); OIDCTokenResponse deserializeOIDCResponse = deserialize(response, OIDCTokenResponse.class); this.options.setAccessToken(deserializeOIDCResponse.getAccessToken()); return deserializeOIDCResponse; } /** * 检验 CAS 1.0 Ticket 合法性 */ public ValidateTicketV1Response validateTicketV1(String ticket, String service) { String url = this.options.getAppHost() + "/cas-idp/" + this.options.getAppId() + "/validate"; Map<String, Object> paramsMap = new HashMap<>(); paramsMap.put("ticket", ticket); paramsMap.put("service", service); url = HttpUtils.buildUrlWithQueryParams(url, paramsMap); AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl(url); String response = request(config); ValidateTicketV1Response validateTicketV1Response = deserialize(response, ValidateTicketV1Response.class); System.out.println("ValidateTicketV1Response:" + validateTicketV1Response.toString()); return validateTicketV1Response; } /** * 通过远端服务验证票据合法性 */ public String validateTicketV2(String ticket, String service, String format) throws Exception { if (format != "XML" && format != "JSON") { throw new Exception("format 参数可选值为 XML、JSON,请检查输入"); } String url = this.options.getAppHost() + "/cas-idp/" + this.options.getAppId() + "/serviceValidate"; Map<String, Object> paramsMap = new HashMap<>(); paramsMap.put("ticket", ticket); paramsMap.put("service", service); paramsMap.put("format", format); url = HttpUtils.buildUrlWithQueryParams(url, paramsMap); AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl(url); String response = request(config); return response; } /** * 生成 PKCE 校验码摘要值 */ public String getCodeChallengeDigest(CodeChallengeDigestParam options) throws Exception { String codeChallenge = options.getCodeChallenge(); String method = options.getMethod(); if (StrUtil.isBlank(codeChallenge)) { throw new Exception("请提供 options.codeChallenge,值为一个长度大于等于 43 的字符串"); } if (method == "S256" || method == "") { MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); messageDigest.update(codeChallenge.getBytes("UTF-8")); byte[] encode = Base64.getEncoder().encode(messageDigest.digest()); return new String(encode, Charset.forName("UTF-8")).replace("+", "-") .replace("/", "_").replace("=", ""); } else if (method == "plain") { return codeChallenge; } else { throw new Exception("不支持的 options.method,可选值为 S256、plain"); } } /** * 之前版本 buildLogoutUrl 的补充,由于 buildLogoutUrl 函数名已经被占用,故命名为 buildLogoutUrlNew * * @param params * @return * @throws Exception */ public String buildLogoutUrl(BuildLogoutUrlParams params) throws Exception { if (this.options.getProtocol() == ProtocolEnum.OAUTH.getValue()) { return this.buildCasLogoutUrl(params); } if (this.options.getProtocol() == ProtocolEnum.OIDC.getValue()) { return this.buildOidcLogoutUrl(params); } return buildEasyLogoutUrl(params); } private String buildCasLogoutUrl(BuildLogoutUrlParams params) { String url = ""; if (StrUtil.isNotBlank(params.getPostLogoutRedirectUri())) { url = this.options.getAppHost() + "/cas-idp/logout?url=" + params.getPostLogoutRedirectUri(); } else { url = this.options.getAppHost() + "/cas-idp/logout"; } return url; } private String buildOidcLogoutUrl(BuildLogoutUrlParams params) throws Exception { if ((params.getPostLogoutRedirectUri() != null && params.getIdTokenHint() == null) || (params.getPostLogoutRedirectUri() == null && params.getIdTokenHint() != null)) { throw new Exception("必须同时传入 idToken 和 redirectUri 参数,或者同时都不传入"); } String url = ""; if (StrUtil.isNotBlank(params.getPostLogoutRedirectUri())) { url = this.options.getAppHost() + "/oidc/session/end?id_token_hint=" + params.getIdTokenHint() + "&post_logout_redirect_uri=" + params.getPostLogoutRedirectUri(); } else { url = this.options.getAppHost() + "/oidc/session/end"; } return url; } private String buildEasyLogoutUrl(BuildLogoutUrlParams params) throws Exception { String url = ""; if (StrUtil.isNotBlank(params.getPostLogoutRedirectUri())) { url = this.options.getAppHost() + "/login/profile/logout?redirect_uri=" + params.getPostLogoutRedirectUri(); } else { url = this.options.getAppHost() + "/login/profile/logout"; } return url; } /** * Client Credentials 模式获取 Access Token */ public GetAccessTokenByClientCredentialsRespDto getAccessTokenByClientCredentials(String scope, ClientCredentialInput options) throws Exception { if (StrUtil.isEmpty(scope)) { throw new InvalidParameterException( "请传入 scope 参数,请看文档:https://docs.authing.cn/v2/guides/authorization/m2m-authz.html"); } if (options == null) { throw new InvalidParameterException( "请在调用本方法时传入 { accessKey: string, accessSecret: string },请看文档:https://docs.authing.cn/v2/guides/authorization/m2m-authz.html"); } GetAccessTokenByClientCredentialsDto reqDto = new GetAccessTokenByClientCredentialsDto(); reqDto.setScope(scope); reqDto.setClientId(options.getAccessKey()); reqDto.setClientSecret(options.getAccessSecret()); reqDto.setGrantType(TokenEndPointParams.Grant_type.CLIENT_CREDENTIALS.getValue()); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/oidc/token"); config.setBody(reqDto); config.setMethod("UrlencodedPOST"); config.setHeaders(headers); String response = request(config); return deserialize(response, GetAccessTokenByClientCredentialsRespDto.class); } /** * accessToken 换取用户信息 */ public UserInfo getUserInfoByAccessToken(String accessToken) { AuthingRequestConfig config = new AuthingRequestConfig(); if (ProtocolEnum.OAUTH.getValue().equals(options.getProtocol())) { config.setMethod("POST"); config.setBody(new Object()); } else { config.setMethod("GET"); } config.setUrl("/oidc/me/?access_token=" + accessToken); String response = request(config); return deserialize(response, UserInfo.class); } /** * accessToken 换取用户信息,用户可以自取自定义的扩展字段 */ public Map<String, Object> getUserInfoMapByAccessToken(String accessToken) { AuthingRequestConfig config = new AuthingRequestConfig(); if (ProtocolEnum.OAUTH.getValue().equals(options.getProtocol())) { config.setMethod("POST"); config.setBody(new Object()); } else { config.setMethod("GET"); } config.setUrl("/oidc/me/?access_token=" + accessToken); String response = request(config); return deserialize(response, Map.class); } /** * 拼接 OIDC、OAuth 2.0、SAML、CAS 协议授权链接 */ public String buildAuthorizeUrl(IOidcParams params) { if (options.getAppId() == null) { throw new InvalidParameterException("请在初始化 AuthenticationClient 时传入 appId"); } if (!ProtocolEnum.OIDC.getValue().equals(options.getProtocol())) { throw new InvalidParameterException( "初始化 AuthenticationClient 传入的 protocol 应为 ProtocolEnum.OIDC 不应该为" + options.getProtocol()); } if (StrUtil.isEmpty(options.getRedirectUri()) && StrUtil.isEmpty(params.getRedirectUri())) { throw new InvalidParameterException( "redirectUri 不应该为空 解决方法:请在 AuthenticationClient 初始化时传入 redirectUri,或者调用 buildAuthorizeUrl 时传入 redirectUri"); } Map<String, Object> map = new HashMap<>(); map.put("client_id", options.getAppId()); map.put("scope", Optional.ofNullable(params.getScope()).orElse("openid profile email phone address")); map.put("state", Optional.ofNullable(params.getState()).orElse(CommonUtils.createRandomString(12))); map.put("nonce", Optional.ofNullable(params.getNonce()).orElse(CommonUtils.createRandomString(12))); map.put("response_mode", Optional.ofNullable(params.getResponseMode()).orElse(null)); map.put("response_type", Optional.ofNullable(params.getResponseType()).orElse("code")); map.put("redirect_uri", Optional.ofNullable(params.getRedirectUri()).orElse(options.getRedirectUri())); if (!Objects.isNull(params.getPrompt())) { map.put("prompt", params.getPrompt()); } else { map.put("prompt", params.getScope() != null && params.getScope().contains("offline_access") ? "consent" : null); } if (StrUtil.isNotBlank(params.getTenantId())) { map.put("tenant_id", params.getTenantId()); } return HttpUtils.buildUrlWithQueryParams(options.getAppHost() + "/oidc/auth", map); } /** * 拼接 CAS 协议授权链接 */ public String buildAuthorizeUrl(ICasParams params) { if (options.getAppId() == null) { throw new InvalidParameterException("请在初始化 AuthenticationClient 时传入 appId"); } if (!ProtocolEnum.CAS.getValue().equals(options.getProtocol())) { throw new InvalidParameterException( "初始化 AuthenticationClient 传入的 protocol 应为 ProtocolEnum.CAS 不应该为" + options.getProtocol()); } if (StrUtil.isNotBlank(params.getService())) { return options.getAppHost() + "/cas-idp/" + options.getAppId() + "?service=" + params.getService(); } else { return options.getAppHost() + "/cas-idp/" + options.getAppId(); } } /** * 拼接 SAML 协议授权链接 */ public String buildAuthorizeUrl() { if (options.getAppId() == null) { throw new InvalidParameterException("请在初始化 AuthenticationClient 时传入 appId"); } if (!ProtocolEnum.SAML.getValue().equals(options.getProtocol())) { throw new InvalidParameterException( "初始化 AuthenticationClient 传入的 protocol 应为 ProtocolEnum.SAML 不应该为" + options.getProtocol()); } return options.getAppHost() + "/api/v2/saml-idp/" + options.getAppId(); } /** * 拼接 OAUTH 2.0 协议授权链接 */ public String buildAuthorizeUrl(IOauthParams params) { if (options.getAppId() == null) { throw new InvalidParameterException("请在初始化 AuthenticationClient 时传入 appId"); } if (!ProtocolEnum.OAUTH.getValue().equals(options.getProtocol())) { throw new InvalidParameterException( "初始化 AuthenticationClient 传入的 protocol 应为 ProtocolEnum.OAUTH 不应该为" + options.getProtocol()); } if (StrUtil.isEmpty(options.getRedirectUri()) && StrUtil.isEmpty(params.getRedirectUri())) { throw new InvalidParameterException( "redirectUri 不应该为空 解决方法:请在 AuthenticationClient 初始化时传入 redirectUri,或者调用 buildAuthorizeUrl 时传入 redirectUri"); } Map<String, Object> map = new HashMap<>(); map.put("client_id", options.getAppId()); map.put("scope", Optional.ofNullable(params.getScope()).orElse("user")); map.put("state", Optional.ofNullable(params.getState()).orElse(CommonUtils.createRandomString(12))); map.put("response_type", Optional.ofNullable(params.getResponseType()).orElse("code")); map.put("redirect_uri", Optional.ofNullable(params.getRedirectUri()).orElse(options.getRedirectUri())); map.put("prompt", params.getScope() != null && params.getScope().contains("offline_access") ? "consent" : null); if (StrUtil.isNotBlank(params.getTenantId())) { map.put("tenant_id", params.getTenantId()); } return HttpUtils.buildUrlWithQueryParams(options.getAppHost() + "/oidc/auth", map); } /** * 使用 Refresh token 获取新的 Access token */ public GetNewAccessTokenByRefreshTokenRespDto getNewAccessTokenByRefreshToken( String refreshToken) { verificationProtocol(); String tokenEndPointAuthMethod = options.getTokenEndPointAuthMethod(); if (AuthMethodEnum.CLIENT_SECRET_POST.getValue().equals(tokenEndPointAuthMethod)) { return getNewAccessTokenByRefreshTokenWithClientSecretPost(refreshToken); } else if (AuthMethodEnum.CLIENT_SECRET_BASIC.getValue().equals(tokenEndPointAuthMethod)) { return getNewAccessTokenByRefreshTokenWithClientSecretBasic(refreshToken); } else { return getNewAccessTokenByRefreshTokenWithNone(refreshToken); } } private void verificationProtocol() { if (!(ProtocolEnum.OAUTH.getValue().equals(options.getProtocol()) || ProtocolEnum.OIDC.getValue().equals(options.getProtocol()))) { throw new InvalidParameterException( "初始化 AuthenticationClient 时传入的 protocol 参数必须为 ProtocolEnum.OAUTH 或 ProtocolEnum.OIDC,请检查参数"); } if (StrUtil.isEmpty(options.getAppSecret()) && !AuthMethodEnum.NONE.getValue() .equals(options.getTokenEndPointAuthMethod())) { throw new InvalidParameterException( "请在初始化 AuthenticationClient 时传入 appId 和 secret 参数"); } } private GetNewAccessTokenByRefreshTokenRespDto getNewAccessTokenByRefreshTokenWithClientSecretPost( String refreshToken) { AuthingRequestConfig config = new AuthingRequestConfig(); if (ProtocolEnum.OIDC.getValue().equals(options.getProtocol())) { config.setUrl("/oidc/token"); } else { config.setUrl("/oauth/token"); } config.setMethod("UrlencodedPOST"); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); config.setHeaders(headers); GetNewAccessTokenByRefreshTokenDto reqDto = new GetNewAccessTokenByRefreshTokenDto(); reqDto.setClientId(options.getAppId()); reqDto.setClientSecret(options.getAppSecret()); reqDto.setGrantType(TokenEndPointParams.Grant_type.REFRESH_TOKEN.getValue()); reqDto.setRefreshToken(refreshToken); config.setBody(reqDto); String response = request(config); return deserialize(response, GetNewAccessTokenByRefreshTokenRespDto.class); } private GetNewAccessTokenByRefreshTokenRespDto getNewAccessTokenByRefreshTokenWithClientSecretBasic( String refreshToken) { String basic64Str = "Basic " + Base64Encoder.encode( (options.getAppId() + ":" + options.getAppSecret()).getBytes()); AuthingRequestConfig config = new AuthingRequestConfig(); if (ProtocolEnum.OIDC.getValue().equals(options.getProtocol())) { config.setUrl("/oidc/token"); } else { config.setUrl("/oauth/token"); } config.setMethod("UrlencodedPOST"); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); headers.put(Header.AUTHORIZATION.getValue(), basic64Str); config.setHeaders(headers); GetNewAccessTokenByRefreshTokenDto reqDto = new GetNewAccessTokenByRefreshTokenDto(); reqDto.setGrantType(TokenEndPointParams.Grant_type.REFRESH_TOKEN.getValue()); reqDto.setRefreshToken(refreshToken); config.setBody(reqDto); String resqonse = request(config); return deserialize(resqonse, GetNewAccessTokenByRefreshTokenRespDto.class); } private GetNewAccessTokenByRefreshTokenRespDto getNewAccessTokenByRefreshTokenWithNone( String refreshToken) { AuthingRequestConfig config = new AuthingRequestConfig(); if (ProtocolEnum.OIDC.getValue().equals(options.getProtocol())) { config.setUrl("/oidc/token"); } else { config.setUrl("/oauth/token"); } config.setMethod("UrlencodedPOST"); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); config.setHeaders(headers); GetNewAccessTokenByRefreshTokenDto reqDto = new GetNewAccessTokenByRefreshTokenDto(); reqDto.setClientId(options.getAppId()); reqDto.setGrantType(TokenEndPointParams.Grant_type.REFRESH_TOKEN.getValue()); reqDto.setRefreshToken(refreshToken); config.setBody(reqDto); String response = request(config); return deserialize(response, GetNewAccessTokenByRefreshTokenRespDto.class); } /** * 检查 Access token 或 Refresh token 的状态 */ public IntrospectTokenRespDto introspectToken(String token) { verificationProtocol(); String introspectionEndPointAuthMethod = options.getIntrospectionEndPointAuthMethod(); if (AuthMethodEnum.CLIENT_SECRET_POST.getValue().equals(introspectionEndPointAuthMethod)) { return introspectTokenWithClientSecretPost(token); } else if (AuthMethodEnum.CLIENT_SECRET_BASIC.getValue() .equals(introspectionEndPointAuthMethod)) { return introspectTokenWithClientSecretBasic(token); } else { return introspectTokenWithNone(token); } } private IntrospectTokenRespDto introspectTokenWithClientSecretPost(String token) { AuthingRequestConfig config = new AuthingRequestConfig(); if (ProtocolEnum.OIDC.getValue().equals(options.getProtocol())) { config.setUrl("/oidc/token/introspection"); } else { config.setUrl("/oauth/token/introspection"); } config.setMethod("UrlencodedPOST"); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); config.setHeaders(headers); IntrospectTokenDto reqDto = new IntrospectTokenDto(); reqDto.setClientId(options.getAppId()); reqDto.setClientSecret(options.getAppSecret()); reqDto.setToken(token); config.setBody(reqDto); String response = request(config); return deserialize(response, IntrospectTokenRespDto.class); } private IntrospectTokenRespDto introspectTokenWithClientSecretBasic(String token) { String basic64Str = "Basic " + Base64Encoder.encode( (options.getAppId() + ":" + options.getAppSecret()).getBytes()); AuthingRequestConfig config = new AuthingRequestConfig(); if (ProtocolEnum.OIDC.getValue().equals(options.getProtocol())) { config.setUrl("/oidc/token/introspection"); } else { config.setUrl("/oauth/token/introspection"); } config.setMethod("UrlencodedPOST"); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); headers.put(Header.AUTHORIZATION.getValue(), basic64Str); config.setHeaders(headers); IntrospectTokenDto reqDto = new IntrospectTokenDto(); reqDto.setToken(token); config.setBody(reqDto); String response = request(config); return deserialize(response, IntrospectTokenRespDto.class); } private IntrospectTokenRespDto introspectTokenWithNone(String token) { AuthingRequestConfig config = new AuthingRequestConfig(); if (ProtocolEnum.OIDC.getValue().equals(options.getProtocol())) { config.setUrl("/oidc/token/introspection"); } else { config.setUrl("/oauth/token/introspection"); } config.setMethod("UrlencodedPOST"); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); config.setHeaders(headers); IntrospectTokenDto reqDto = new IntrospectTokenDto(); reqDto.setClientId(options.getAppId()); reqDto.setToken(token); config.setBody(reqDto); String response = request(config); return deserialize(response, IntrospectTokenRespDto.class); } /** * 效验Token合法性 */ public ValidateTokenRespDto validateToken(ValidateTokenParams params) { String idToken = params.getIdToken(); String accessToken = params.getAccessToken(); if (idToken == null && accessToken == null) { throw new InvalidParameterException("请在传入的参数对象中包含 accessToken 或 idToken 字段"); } if (accessToken != null && idToken != null) { throw new InvalidParameterException("accessToken 和 idToken 只能传入一个,不能同时传入"); } AuthingRequestConfig config = new AuthingRequestConfig(); if (accessToken != null) { config.setUrl("/api/v2/oidc/validate_token?access_token=" + accessToken); } else { config.setUrl("/api/v2/oidc/validate_token?id_token=" + idToken); } config.setMethod("GET"); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); config.setHeaders(headers); String response = request(config); return deserialize(response, ValidateTokenRespDto.class); } /** * 撤回 Access token 或 Refresh token */ public boolean revokeToken(String token) { verificationProtocol(); String revocationEndPointAuthMethod = options.getRevocationEndPointAuthMethod(); if (AuthMethodEnum.CLIENT_SECRET_POST.getValue().equals(revocationEndPointAuthMethod)) { return revokeTokenWithClientSecretPost(token); } else if (AuthMethodEnum.CLIENT_SECRET_BASIC.getValue().equals(revocationEndPointAuthMethod)) { return revokeTokenWithClientSecretBasic(token); } else { return revokeTokenWithNone(token); } } private boolean revokeTokenWithClientSecretPost(String token) { AuthingRequestConfig config = new AuthingRequestConfig(); if (ProtocolEnum.OIDC.getValue().equals(options.getProtocol())) { config.setUrl("/oidc/token/revocation"); } else { config.setUrl("/oauth/token/revocation"); } config.setMethod("UrlencodedPOST"); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); config.setHeaders(headers); RevokeTokenDto reqDto = new RevokeTokenDto(); reqDto.setClientId(options.getAppId()); reqDto.setClientSecret(options.getAppSecret()); reqDto.setToken(token); config.setBody(reqDto); // 暂时修改为恒 true request(config); return true; } private boolean revokeTokenWithClientSecretBasic(String token) { if (ProtocolEnum.OAUTH.getValue().equals(options.getProtocol())) { throw new InvalidParameterException( "OAuth 2.0 暂不支持用 client_secret_basic 模式身份验证撤回 Token"); } String basic64Str = "Basic " + Base64Encoder.encode( (options.getAppId() + ":" + options.getAppSecret()).getBytes()); AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/oidc/token/revocation"); config.setMethod("UrlencodedPOST"); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); headers.put(Header.AUTHORIZATION.getValue(), basic64Str); config.setHeaders(headers); RevokeTokenDto reqDto = new RevokeTokenDto(); reqDto.setToken(token); config.setBody(reqDto); request(config); return true; } private boolean revokeTokenWithNone(String token) { AuthingRequestConfig config = new AuthingRequestConfig(); if (ProtocolEnum.OIDC.getValue().equals(options.getProtocol())) { config.setUrl("/oidc/token/revocation"); } else { config.setUrl("/oauth/token/revocation"); } config.setMethod("UrlencodedPOST"); Map<String, String> headers = new HashMap<>(); headers.put(Header.CONTENT_TYPE.getValue(), "application/x-www-form-urlencoded"); config.setHeaders(headers); RevokeTokenDto reqDto = new RevokeTokenDto(); reqDto.setToken(token); reqDto.setClientId(options.getAppId()); config.setBody(reqDto); request(config); return true; } /** * 使用用户名 + 密码登录 * * @param username 用户名 * @param password 用户密码,默认不加密。Authing 所有 API 均通过 HTTPS * 协议对密码进行安全传输,可以在一定程度上保证安全性。如果你还需要更高级别的安全性,我们还支持 `RSA256` 和国密 `SM2` * 的密码加密方式。详情见可选参数 `options.passwordEncryptType`。 * @param options 认证可选参数 * @return */ public LoginTokenRespDto signInByUsernamePassword(String username, String password, SignInOptionsDto options) { SigninByCredentialsDto dto = new SigninByCredentialsDto(); // 设置认证方式 dto.setConnection(SigninByCredentialsDto.Connection.PASSWORD); // 设置认证数据 SignInByPasswordPayloadDto payload = new SignInByPasswordPayloadDto(); payload.setUsername(username); payload.setPassword(password); dto.setPasswordPayload(payload); // 设置可选参数 dto.setOptions(options); // 设置 client_id 和 client_secret if (this.options.getTokenEndPointAuthMethod() == AuthMethodEnum.CLIENT_SECRET_POST.getValue()) { dto.setClientId(this.options.getAppId()); dto.setClientSecret(this.options.getAppSecret()); } return this.signInByCredentials(dto); } /** * 使用邮箱 + 密码登录 * * @param email 邮箱 * @param password 用户密码,默认不加密。Authing 所有 API 均通过 HTTPS * 协议对密码进行安全传输,可以在一定程度上保证安全性。如果你还需要更高级别的安全性,我们还支持 `RSA256` 和国密 `SM2` * 的密码加密方式。详情见可选参数 `options.passwordEncryptType`。 * @param options 认证可选参数 * @return */ public LoginTokenRespDto signInByEmailPassword(String email, String password, SignInOptionsDto options) { SigninByCredentialsDto dto = new SigninByCredentialsDto(); // 设置认证方式 dto.setConnection(SigninByCredentialsDto.Connection.PASSWORD); // 设置认证数据 SignInByPasswordPayloadDto payload = new SignInByPasswordPayloadDto(); payload.setEmail(email); payload.setPassword(password); dto.setPasswordPayload(payload); // 设置可选参数 dto.setOptions(options); // 设置 client_id 和 client_secret if (this.options.getTokenEndPointAuthMethod() == AuthMethodEnum.CLIENT_SECRET_POST.getValue()) { dto.setClientId(this.options.getAppId()); dto.setClientSecret(this.options.getAppSecret()); } return this.signInByCredentials(dto); } /** * 使用手机号 + 密码登录 * * @param phone 手机号 * @param password 用户密码,默认不加密。Authing 所有 API 均通过 HTTPS * 协议对密码进行安全传输,可以在一定程度上保证安全性。如果你还需要更高级别的安全性,我们还支持 `RSA256` 和国密 `SM2` * 的密码加密方式。详情见可选参数 `options.passwordEncryptType`。 * @param options 认证可选参数 * @return */ public LoginTokenRespDto signInByPhonePassword(String phone, String password, SignInOptionsDto options) { SigninByCredentialsDto dto = new SigninByCredentialsDto(); // 设置认证方式 dto.setConnection(SigninByCredentialsDto.Connection.PASSWORD); // 设置认证数据 SignInByPasswordPayloadDto payload = new SignInByPasswordPayloadDto(); payload.setPhone(phone); payload.setPassword(password); dto.setPasswordPayload(payload); // 设置可选参数 dto.setOptions(options); // 设置 client_id 和 client_secret if (this.options.getTokenEndPointAuthMethod() == AuthMethodEnum.CLIENT_SECRET_POST.getValue()) { dto.setClientId(this.options.getAppId()); dto.setClientSecret(this.options.getAppSecret()); } return this.signInByCredentials(dto); } /** * 使用账号(手机号/邮箱/用户名) + 密码登录 * * @param acconnt 账号(手机号/邮箱/用户名) * @param password 用户密码,默认不加密。Authing 所有 API 均通过 HTTPS * 协议对密码进行安全传输,可以在一定程度上保证安全性。如果你还需要更高级别的安全性,我们还支持 `RSA256` 和国密 `SM2` * 的密码加密方式。详情见可选参数 `options.passwordEncryptType`。 * @param options 认证可选参数 * @return */ public LoginTokenRespDto signInByAccountPassword(String acconnt, String password, SignInOptionsDto options) { SigninByCredentialsDto dto = new SigninByCredentialsDto(); // 设置认证方式 dto.setConnection(SigninByCredentialsDto.Connection.PASSWORD); // 设置认证数据 SignInByPasswordPayloadDto payload = new SignInByPasswordPayloadDto(); payload.setAccount(acconnt); payload.setPassword(password); dto.setPasswordPayload(payload); // 设置可选参数 dto.setOptions(options); // 设置 client_id 和 client_secret if (this.options.getTokenEndPointAuthMethod() == AuthMethodEnum.CLIENT_SECRET_POST.getValue()) { dto.setClientId(this.options.getAppId()); dto.setClientSecret(this.options.getAppSecret()); } return this.signInByCredentials(dto); } /** * 使用手机号 + 验证码登录 * * @param phone 手机号 * @param phoneCountryCode 手机区号 * @param passCode 验证码 * @param options 认证可选参数 * @return */ public LoginTokenRespDto signInByPhonePassCode(String phone, String passCode, String phoneCountryCode, SignInOptionsDto options) { SigninByCredentialsDto dto = new SigninByCredentialsDto(); // 设置认证方式 dto.setConnection(SigninByCredentialsDto.Connection.PASSCODE); // 设置认证数据 SignInByPassCodePayloadDto payload = new SignInByPassCodePayloadDto(); payload.setPhone(phone); payload.setPhoneCountryCode(phoneCountryCode); payload.setPassCode(passCode); dto.setPassCodePayload(payload); // 设置可选参数 dto.setOptions(options); // 设置 client_id 和 client_secret if (this.options.getTokenEndPointAuthMethod() == AuthMethodEnum.CLIENT_SECRET_POST.getValue()) { dto.setClientId(this.options.getAppId()); dto.setClientSecret(this.options.getAppSecret()); } return this.signInByCredentials(dto); } /** * 使用邮箱 + 验证码登录 * * @param email 邮箱 * @param passCode 验证码 * @param options 认证可选参数 * @return */ public LoginTokenRespDto signInByEmailPassCode(String email, String passCode, SignInOptionsDto options) { SigninByCredentialsDto dto = new SigninByCredentialsDto(); // 设置认证方式 dto.setConnection(SigninByCredentialsDto.Connection.PASSCODE); // 设置认证数据 SignInByPassCodePayloadDto payload = new SignInByPassCodePayloadDto(); payload.setEmail(email); payload.setPassCode(passCode); dto.setPassCodePayload(payload); // 设置可选参数 dto.setOptions(options); // 设置 client_id 和 client_secret if (this.options.getTokenEndPointAuthMethod() == AuthMethodEnum.CLIENT_SECRET_POST.getValue()) { dto.setClientId(this.options.getAppId()); dto.setClientSecret(this.options.getAppSecret()); } return this.signInByCredentials(dto); } /** * 使用 LDAP 账号密码登录 * * @param sAMAccountName LDAP 用户目录中账号的 sAMAccountName * @param password 用户密码,默认不加密。Authing 所有 API 均通过 HTTPS * 协议对密码进行安全传输,可以在一定程度上保证安全性。如果你还需要更高级别的安全性,我们还支持 `RSA256` 和国密 `SM2` * 的密码加密方式。详情见可选参数 `options.passwordEncryptType`。 * @param options 认证可选参数 * @return */ public LoginTokenRespDto signInByLDAP(String sAMAccountName, String password, SignInOptionsDto options) { SigninByCredentialsDto dto = new SigninByCredentialsDto(); // 设置认证方式 dto.setConnection(SigninByCredentialsDto.Connection.LDAP); // 设置认证数据 SignInByLdapPayloadDto payload = new SignInByLdapPayloadDto(); payload.setPassword(password); payload.setSAMAccountName(sAMAccountName); dto.setLdapPayload(payload); // 设置可选参数 dto.setOptions(options); // 设置 client_id 和 client_secret if (this.options.getTokenEndPointAuthMethod() == AuthMethodEnum.CLIENT_SECRET_POST.getValue()) { dto.setClientId(this.options.getAppId()); dto.setClientSecret(this.options.getAppSecret()); } return this.signInByCredentials(dto); } /** * 使用 AD 账号密码登录 * * @param sAMAccountName LDAP 用户目录中账号的 sAMAccountName * @param password 用户密码,默认不加密。Authing 所有 API 均通过 HTTPS * 协议对密码进行安全传输,可以在一定程度上保证安全性。如果你还需要更高级别的安全性,我们还支持 `RSA256` 和国密 `SM2` * 的密码加密方式。详情见可选参数 `options.passwordEncryptType`。 * @param options 认证可选参数 * @return */ public LoginTokenRespDto signInByAD(String sAMAccountName, String password, SignInOptionsDto options) { SigninByCredentialsDto dto = new SigninByCredentialsDto(); // 设置认证方式 dto.setConnection(SigninByCredentialsDto.Connection.AD); // 设置认证数据 SignInByAdPayloadDto payload = new SignInByAdPayloadDto(); payload.setPassword(password); payload.setSAMAccountName(sAMAccountName); dto.setAdPayload(payload); // 设置可选参数 dto.setOptions(options); // 设置 client_id 和 client_secret if (this.options.getTokenEndPointAuthMethod() == AuthMethodEnum.CLIENT_SECRET_POST.getValue()) { dto.setClientId(this.options.getAppId()); dto.setClientSecret(this.options.getAppSecret()); } return this.signInByCredentials(dto); } /** * 使用用户名 + 密码注册 * * @param username 用户名 * @param password 用户密码,默认不加密。Authing 所有 API 均通过 HTTPS * 协议对密码进行安全传输,可以在一定程度上保证安全性。如果你还需要更高级别的安全性,我们还支持 `RSA256` 和国密 `SM2` * 的密码加密方式。详情见可选参数 `options.passwordEncryptType`。 * @param profile 注册时额外设置的用户资料,可选 * @param options 注册可选参数 * @return */ public UserSingleRespDto signUpByUsernamePassword(String username, String password, SignUpProfileDto profile, SignUpOptionsDto options) { SignUpDto dto = new SignUpDto(); // 设置认证方式 dto.setConnection(SignUpDto.Connection.PASSWORD); // 设置注册数据 SignUpByPasswordDto payload = new SignUpByPasswordDto(); payload.setPassword(password); payload.setUsername(username); dto.setPasswordPayload(payload); // 设置可选的个人资料 dto.setProfile(profile); // 设置可选参数 dto.setOptions(options); return this.signUp(dto); } /** * 使用邮箱 + 密码注册 * * @param email 邮箱 * @param password 用户密码,默认不加密。Authing 所有 API 均通过 HTTPS * 协议对密码进行安全传输,可以在一定程度上保证安全性。如果你还需要更高级别的安全性,我们还支持 `RSA256` 和国密 `SM2` * 的密码加密方式。详情见可选参数 `options.passwordEncryptType`。 * @param profile 注册时额外设置的用户资料,可选 * @param options 注册可选参数 * @return */ public UserSingleRespDto signUpByEmailPassword(String email, String password, SignUpProfileDto profile, SignUpOptionsDto options) { SignUpDto dto = new SignUpDto(); // 设置认证方式 dto.setConnection(SignUpDto.Connection.PASSWORD); // 设置注册数据 SignUpByPasswordDto payload = new SignUpByPasswordDto(); payload.setPassword(password); payload.setEmail(email); dto.setPasswordPayload(payload); // 设置可选的个人资料 dto.setProfile(profile); // 设置可选参数 dto.setOptions(options); return this.signUp(dto); } /** * 使用邮箱 + 验证码注册 * * @param email 邮箱 * @param passCode 验证码 * @param profile 注册时额外设置的用户资料,可选 * @param options 注册可选参数 * @return */ public UserSingleRespDto signUpByEmailPassCode(String email, String passCode, SignUpProfileDto profile, SignUpOptionsDto options) { SignUpDto dto = new SignUpDto(); // 设置认证方式 dto.setConnection(SignUpDto.Connection.PASSCODE); // 设置注册数据 SignUpByPassCodeDto payload = new SignUpByPassCodeDto(); payload.setPassCode(passCode); payload.setEmail(email); dto.setPassCodePayload(payload); // 设置可选的个人资料 dto.setProfile(profile); // 设置可选参数 dto.setOptions(options); return this.signUp(dto); } /** * 使用手机号 + 验证码注册 * * @param phone 手机号 * @param phoneCountryCode 手机区号 * @param passCode 验证码 * @param profile 注册时额外设置的用户资料,可选 * @param options 注册可选参数 * @return */ public UserSingleRespDto signUpByPhonePassCode(String phone, String passCode, String phoneCountryCode, SignUpProfileDto profile, SignUpOptionsDto options) { SignUpDto dto = new SignUpDto(); // 设置认证方式 dto.setConnection(SignUpDto.Connection.PASSCODE); // 设置注册数据 SignUpByPassCodeDto payload = new SignUpByPassCodeDto(); payload.setPassCode(passCode); payload.setPhone(phone); payload.setPhoneCountryCode(phoneCountryCode); dto.setPassCodePayload(payload); // 设置可选的个人资料 dto.setProfile(profile); // 设置可选参数 dto.setOptions(options); return this.signUp(dto); } // ==== AUTO GENERATED AUTHENTICATION METHODS BEGIN ==== /** * @summary 注册 * @description * 此端点目前支持以下几种基于的注册方式: * * 1. 基于密码(PASSWORD):用户名 + 密码,邮箱 + 密码。 * 2. 基于一次性临时验证码(PASSCODE):手机号 + 验证码,邮箱 + 验证码。你需要先调用发送短信或者发送邮件接口获取验证码。 * * 社会化登录等使用外部身份源“注册”请直接使用**登录**接口,我们会在其第一次登录的时候为其创建一个新账号。 * **/ public UserSingleRespDto signUp(SignUpDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/signup"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UserSingleRespDto.class); } /** * @summary 生成绑定外部身份源的链接 * @description * 此接口用于生成绑定外部身份源的链接,生成之后可以引导用户进行跳转。 * **/ public GenerateBindExtIdpLinkRespDto generateLinkExtIdpUrl(GenerateLinkExtidpUrlDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/generate-link-extidp-url"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GenerateBindExtIdpLinkRespDto.class); } /** * @summary 解绑外部身份源 * @description 解绑外部身份源,此接口需要传递用户绑定的外部身份源 ID,**注意不是身份源连接 ID**。 **/ public CommonResponseDto unlinkExtIdp(UnlinkExtIdpDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/unlink-extidp"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取绑定的外部身份源 * @description * 如在**介绍**部分中所描述的,一个外部身份源对应多个外部身份源连接,用户通过某个外部身份源连接绑定了某个外部身份源账号之后, * 用户会建立一条与此外部身份源之间的关联关系。此接口用于获取此用户绑定的所有外部身份源。 * * 取决于外部身份源的具体实现,一个用户在外部身份源中,可能会有多个身份 ID,比如在微信体系中会有 `openid` 和 `unionid`,在非书中有 * `open_id`、`union_id` 和 `user_id`。在 Authing 中,我们把这样的一条 `open_id` 或者 `unionid_` 叫做一条 `Identity`, 所以用户在一个身份源会有多条 `Identity` 记录。 * * 以微信为例,如果用户使用微信登录或者绑定了微信账号,他的 `Identity` 信息如下所示: * * ```json * [ * { * "identityId": "62f20932xxxxbcc10d966ee5", * "extIdpId": "62f209327xxxxcc10d966ee5", * "provider": "wechat", * "type": "openid", * "userIdInIdp": "oH_5k5SflrwjGvk7wqpoBKq_cc6M", * "originConnIds": ["62f2093244fa5cb19ff21ed3"] * }, * { * "identityId": "62f726239xxxxe3285d21c93", * "extIdpId": "62f209327xxxxcc10d966ee5", * "provider": "wechat", * "type": "unionid", * "userIdInIdp": "o9Nka5ibU-lUGQaeAHqu0nOZyJg0", * "originConnIds": ["62f2093244fa5cb19ff21ed3"] * } * ] * ``` * * * 可以看到他们的 `extIdpId` 是一样的,这个是你在 Authing 中创建的**身份源 ID**;`provider` 都是 `wechat`; * 通过 `type` 可以区分出哪个是 `openid`,哪个是 `unionid`,以及具体的值(`userIdInIdp`);他们都来自于同一个身份源连接(`originConnIds`)。 * * * **/ public GetIdentitiesRespDto getIdentities() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-identities"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetIdentitiesRespDto.class); } /** * @summary 获取应用开启的外部身份源列表 * @description 获取应用开启的外部身份源列表,前端可以基于此渲染外部身份源按钮。 **/ public GetExtIdpsRespDto getApplicationEnabledExtIdps() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-application-enabled-extidps"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetExtIdpsRespDto.class); } /** * @summary 使用用户凭证登录 * @description * 此端点为基于直接 API 调用形式的登录端点,适用于你需要自建登录页面的场景。**此端点暂时不支持 MFA、信息补全、首次密码重置等流程,如有需要,请使用 OIDC 标准协议认证端点。** * * * 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 * * <details> * <summary>点击展开详情</summary> * * <br> * * 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置** * 中找到**换取 token 身份验证方式** 配置项: * * > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 * * ![](https://files.authing.co/api-explorer/tokenAuthMethod.jpg) * * #### 换取 token 身份验证方式为 none 时 * * 调用此接口不需要进行额外操作。 * * #### 换取 token 身份验证方式为 client_secret_post 时 * * 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 * * #### 换取 token 身份验证方式为 client_secret_basic 时 * * 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): * * ``` * Basic base64(<client_id>:<client_secret>) * ``` * * 结果示例: * * ``` * Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3 * ``` * * JS 代码示例: * * ```js * 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64'); * ``` * * </details> * * **/ public LoginTokenRespDto signInByCredentials(SigninByCredentialsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/signin"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, LoginTokenRespDto.class); } /** * @summary 使用移动端社会化登录 * @description * 此端点为移动端社会化登录接口,使用第三方移动社会化登录返回的临时凭证登录,并换取用户的 `id_token` 和 `access_token`。请先阅读相应社会化登录的接入流程。 * * * 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 * * <details> * <summary>点击展开详情</summary> * * <br> * * 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置** * 中找到**换取 token 身份验证方式** 配置项: * * > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 * * ![](https://files.authing.co/api-explorer/tokenAuthMethod.jpg) * * #### 换取 token 身份验证方式为 none 时 * * 调用此接口不需要进行额外操作。 * * #### 换取 token 身份验证方式为 client_secret_post 时 * * 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 * * #### 换取 token 身份验证方式为 client_secret_basic 时 * * 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): * * ``` * Basic base64(<client_id>:<client_secret>) * ``` * * 结果示例: * * ``` * Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3 * ``` * * JS 代码示例: * * ```js * 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64'); * ``` * * </details> * * **/ public LoginTokenRespDto signInByMobile(SigninByMobileDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/signin-by-mobile"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, LoginTokenRespDto.class); } /** * @summary 公共账号切换登录 * @description 允许个人账号与关联的公共账号间做切换登录,此端点要求账号已登录 **/ public LoginTokenRespDto switchLoginByUser(PublicAccountSwitchLoginDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/switch-login-by-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, LoginTokenRespDto.class); } /** * @summary 获取支付宝 AuthInfo * @description 此接口用于获取发起支付宝认证需要的[初始化参数 AuthInfo](https://opendocs.alipay.com/open/218/105325)。 **/ public GetAlipayAuthInfoRespDto getAlipayAuthInfo(GetAlipayAuthinfoDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-alipay-authinfo"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetAlipayAuthInfoRespDto.class); } /** * @summary 生成用于登录的二维码 * @description 生成用于登录的二维码,目前支持生成微信公众号扫码登录、小程序扫码登录、自建移动 APP 扫码登录的二维码。 **/ public GeneQRCodeRespDto geneQrCode(GenerateQrcodeDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/gene-qrcode"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GeneQRCodeRespDto.class); } /** * @summary 查询二维码状态 * @description 按照用户扫码顺序,共分为未扫码、已扫码等待用户确认、用户同意/取消授权、二维码过期以及未知错误六种状态,前端应该通过不同的状态给到用户不同的反馈。你可以通过下面这篇文章了解扫码登录详细的流程:https://docs.authing.cn/v2/concepts/how-qrcode-works.html. **/ public CheckQRCodeStatusRespDto checkQrCodeStatus(CheckQrcodeStatusDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-qrcode-status"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CheckQRCodeStatusRespDto.class); } /** * @summary 使用二维码 ticket 换取 TokenSet * @description * 此端点为使用二维码的 ticket 换取用户的 `access_token` 和 `id_token`。 * * * 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 * * <details> * <summary>点击展开详情</summary> * * <br> * * 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置** * 中找到**换取 token 身份验证方式** 配置项: * * > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 * * ![](https://files.authing.co/api-explorer/tokenAuthMethod.jpg) * * #### 换取 token 身份验证方式为 none 时 * * 调用此接口不需要进行额外操作。 * * #### 换取 token 身份验证方式为 client_secret_post 时 * * 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 * * #### 换取 token 身份验证方式为 client_secret_basic 时 * * 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): * * ``` * Basic base64(<client_id>:<client_secret>) * ``` * * 结果示例: * * ``` * Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3 * ``` * * JS 代码示例: * * ```js * 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64'); * ``` * * </details> * * **/ public LoginTokenRespDto exchangeTokenSetWithQrCodeTicket(ExchangeTokenSetWithQRcodeTicketDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/exchange-tokenset-with-qrcode-ticket"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, LoginTokenRespDto.class); } /** * @summary 自建 APP 扫码登录:APP 端修改二维码状态 * @description 此端点用于在自建 APP 扫码登录中修改二维码状态,对应着在浏览器渲染出二维码之后,终端用户扫码、确认授权、取消授权的过程。**此接口要求具备用户的登录态**。 **/ public CommonResponseDto changeQrCodeStatus(ChangeQRCodeStatusDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/change-qrcode-status"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 推送登录 * @description 推送登录。 **/ public GenePushCodeRespDto signInByPush(SignInByPushDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/signin-by-push"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GenePushCodeRespDto.class); } /** * @summary 查询推送码状态 * @description 按照推送码使用顺序,共分为已推送、等待用户 同意/取消 授权、推送码过期以及未知错误五种状态,前端应该通过不同的状态给到用户不同的反馈。 **/ public CheckPushCodeStatusRespDto checkPushCodeStatus(CheckPushcodeStatusDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-pushcode-status"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CheckPushCodeStatusRespDto.class); } /** * @summary 推送登录:APP 端修改推送码状态 * @description 此端点用于在 Authing 令牌 APP 推送登录中修改推送码状态,对应着在浏览器使用推送登录,点击登录之后,终端用户收到推送登录信息,确认授权、取消授权的过程。**此接口要求具备用户的登录态**。 **/ public CommonResponseDto changePushCodeStatus(ChangePushCodeStatusDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/change-pushcode-status"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 发送短信 * @description 发送短信时必须指定短信 Channel,每个手机号同一 Channel 在一分钟内只能发送一次。 **/ public SendSMSRespDto sendSms(SendSMSDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/send-sms"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, SendSMSRespDto.class); } /** * @summary 发送邮件 * @description 发送邮件时必须指定邮件 Channel,每个邮箱同一 Channel 在一分钟内只能发送一次。 **/ public SendEmailRespDto sendEmail(SendEmailDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/send-email"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, SendEmailRespDto.class); } /** * @summary 解密微信小程序数据 * @description 解密微信小程序数据 **/ public DecryptWechatMiniProgramDataRespDto decryptWechatMiniProgramData(DecryptWechatMiniProgramDataDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/decrypt-wechat-miniprogram-data"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, DecryptWechatMiniProgramDataRespDto.class); } /** * @deprecated * @summary 获取微信小程序、公众号 Access Token * @description 获取 Authing 服务器缓存的微信小程序、公众号 Access Token(废弃,请使用 /api/v3/get-wechat-access-token-info) **/ public GetWechatAccessTokenRespDto getWechatMpAccessToken(GetWechatAccessTokenDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-wechat-access-token"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetWechatAccessTokenRespDto.class); } /** * @summary 获取微信小程序、公众号 Access Token * @description 获取 Authing 服务器缓存的微信小程序、公众号 Access Token **/ public GetWechatAccessTokenInfoRespDto getWechatMpAccessTokenInfo(GetWechatAccessTokenDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-wechat-access-token-info"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetWechatAccessTokenInfoRespDto.class); } /** * @summary 获取登录日志 * @description 获取登录日志 **/ public GetLoginHistoryRespDto getLoginHistory(GetMyLoginHistoryDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-my-login-history"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetLoginHistoryRespDto.class); } /** * @summary 获取登录应用 * @description 获取登录应用 **/ public GetLoggedInAppsRespDto getLoggedInApps() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-my-logged-in-apps"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetLoggedInAppsRespDto.class); } /** * @summary 获取具备访问权限的应用 * @description 获取具备访问权限的应用 **/ public GetAccessibleAppsRespDto getAccessibleApps() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-my-accessible-apps"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetAccessibleAppsRespDto.class); } /** * @summary 获取租户列表 * @description 获取租户列表 **/ public GetTenantListRespDto getTenantList() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-my-tenant-list"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetTenantListRespDto.class); } /** * @summary 获取角色列表 * @description 获取角色列表 **/ public RoleListRespDto getRoleList(GetMyRoleListDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-my-role-list"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, RoleListRespDto.class); } /** * @summary 获取分组列表 * @description 获取分组列表 **/ public GroupListRespDto getGroupList() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-my-group-list"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GroupListRespDto.class); } /** * @summary 获取部门列表 * @description 此接口用于获取用户的部门列表,可根据一定排序规则进行排序。 **/ public UserDepartmentPaginatedRespDto getDepartmentList(GetMyDepartmentListDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-my-department-list"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserDepartmentPaginatedRespDto.class); } /** * @summary 获取被授权的资源列表 * @description 此接口用于获取用户被授权的资源列表。 **/ public AuthorizedResourcePaginatedRespDto getAuthorizedResources(GetMyAuthorizedResourcesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-my-authorized-resources"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, AuthorizedResourcePaginatedRespDto.class); } /** * @summary 获取用户资料 * @description 此端点用户获取用户资料,需要在请求头中带上用户的 `access_token`,Authing 服务器会根据用户 `access_token` 中的 `scope` 返回对应的字段。 **/ public UserSingleRespDto getProfile(GetProfileDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-profile"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserSingleRespDto.class); } /** * @summary 修改用户资料 * @description 此接口用于修改用户的用户资料,包含用户的自定义数据。如果需要**修改邮箱**、**修改手机号**、**修改密码**,请使用对应的单独接口。 **/ public UserSingleRespDto updateProfile(UpdateUserProfileDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-profile"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UserSingleRespDto.class); } /** * @summary 绑定邮箱 * @description 如果用户还**没有绑定邮箱**,此接口可用于用户**自主**绑定邮箱。如果用户已经绑定邮箱想要修改邮箱,请使用**修改邮箱**接口。你需要先调用**发送邮件**接口发送邮箱验证码。 **/ public CommonResponseDto bindEmail(BindEmailDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/bind-email"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 解绑邮箱 * @description 用户解绑邮箱,如果用户没有绑定其他登录方式(手机号、社会化登录账号),将无法解绑邮箱,会提示错误。 **/ public CommonResponseDto unbindEmail(UnbindEmailDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/unbind-email"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 绑定手机号 * @description 如果用户还**没有绑定手机号**,此接口可用于用户**自主**绑定手机号。如果用户已经绑定手机号想要修改手机号,请使用**修改手机号**接口。你需要先调用**发送短信**接口发送短信验证码。 **/ public CommonResponseDto bindPhone(BindPhoneDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/bind-phone"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 解绑手机号 * @description 用户解绑手机号,如果用户没有绑定其他登录方式(邮箱、社会化登录账号),将无法解绑手机号,会提示错误。 **/ public CommonResponseDto unbindPhone(UnbindPhoneDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/unbind-phone"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取密码强度和账号安全等级评分 * @description 获取用户的密码强度和账号安全等级评分,需要在请求头中带上用户的 `access_token`。 **/ public GetSecurityInfoRespDto getSecurityLevel() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-security-info"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetSecurityInfoRespDto.class); } /** * @summary 修改密码 * @description 此端点用于用户自主修改密码,如果用户之前已经设置密码,需要提供用户的原始密码作为凭证。如果用户忘记了当前密码,请使用**忘记密码**接口。 **/ public CommonResponseDto updatePassword(UpdatePasswordDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-password"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 发起修改邮箱的验证请求 * @description 终端用户自主修改邮箱时,需要提供相应的验证手段。此接口用于验证用户的修改邮箱请求是否合法。当前支持通过**邮箱验证码**的方式进行验证,你需要先调用发送邮件接口发送对应的邮件验证码。 **/ public VerifyUpdateEmailRequestRespDto verifyUpdateEmailRequest(VerifyUpdateEmailRequestDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/verify-update-email-request"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, VerifyUpdateEmailRequestRespDto.class); } /** * @summary 修改邮箱 * @description 终端用户自主修改邮箱,需要提供相应的验证手段,见[发起修改邮箱的验证请求](#tag/用户资料/API%20列表/operation/ProfileV3Controller_verifyUpdateEmailRequest)。 * 此参数需要提供一次性临时凭证 `updateEmailToken`,此数据需要从**发起修改邮箱的验证请求**接口获取。 **/ public CommonResponseDto updateEmail(UpdateEmailDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-email"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 发起修改手机号的验证请求 * @description 终端用户自主修改手机号时,需要提供相应的验证手段。此接口用于验证用户的修改手机号请求是否合法。当前支持通过**短信验证码**的方式进行验证,你需要先调用发送短信接口发送对应的短信验证码。 **/ public VerifyUpdatePhoneRequestRespDto verifyUpdatePhoneRequest(VerifyUpdatePhoneRequestDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/verify-update-phone-request"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, VerifyUpdatePhoneRequestRespDto.class); } /** * @summary 修改手机号 * @description 终端用户自主修改手机号,需要提供相应的验证手段,见[发起修改手机号的验证请求](#tag/用户资料/API%20列表/operation/ProfileV3Controller_updatePhoneVerification)。 * 此参数需要提供一次性临时凭证 `updatePhoneToken`,此数据需要从**发起修改手机号的验证请求**接口获取。 **/ public CommonResponseDto updatePhone(UpdatePhoneDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-phone"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 发起忘记密码请求 * @description 当用户忘记密码时,可以通过此端点找回密码。用户需要使用相关验证手段进行验证,目前支持**邮箱验证码**和**手机号验证码**两种验证手段。 **/ public PasswordResetVerifyResp verifyResetPasswordRequest(VerifyResetPasswordRequestDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/verify-reset-password-request"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PasswordResetVerifyResp.class); } /** * @summary 忘记密码 * @description 此端点用于用户忘记密码之后,通过**手机号验证码**或者**邮箱验证码**的方式重置密码。此接口需要提供用于重置密码的临时凭证 `passwordResetToken`,此参数需要通过**发起忘记密码请求**接口获取。 **/ public IsSuccessRespDto resetPassword(ResetPasswordDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/reset-password"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 发起注销账号请求 * @description 当用户希望注销账号时,需提供相应凭证,当前支持**使用邮箱验证码**、使用**手机验证码**、**使用密码**三种验证方式。 **/ public VerifyDeleteAccountRequestRespDto verifyDeleteAccountRequest(VerifyDeleteAccountRequestDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/verify-delete-account-request"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, VerifyDeleteAccountRequestRespDto.class); } /** * @summary 注销账户 * @description 此端点用于用户自主注销账号,需要提供用于注销账号的临时凭证 deleteAccountToken,此参数需要通过**发起注销账号请求**接口获取。 **/ public IsSuccessRespDto deleteAccount(DeleteAccounDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-account"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 查询当前登录用户可切换登录的公共账号列表 * @description 此端点用于查询当前登录用户可切换登录的公共账号列表,如果没有可切换登录的公共账号,则返回空数组。 **/ public GetPublicAccountDataRespDto listPublicAccountsForSwitchLoggedIn(GetUserSelectLoginPublicAccountsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-select-login-public-accounts"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetPublicAccountDataRespDto.class); } /** * @summary 获取服务器公开信息 * @description 可端点可获取服务器的公开信息,如 RSA256 公钥、SM2 公钥、Authing 服务版本号等。 **/ public SystemInfoResp getSystemInfo() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/system"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, SystemInfoResp.class); } /** * @summary 获取国家列表 * @description 动态获取国家列表,可以用于前端登录页面国家选择和国际短信输入框选择,以减少前端静态资源体积。 **/ public GetCountryListRespDto getCountryList() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-country-list"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetCountryListRespDto.class); } /** * @summary 字符串类型资源鉴权 * @description 字符串类型资源鉴权,支持用户对一个或者多个字符串资源进行权限判断 **/ public CheckResourcePermissionsRespDto checkPermissionByStringResource(CheckPermissionStringResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-permission-string-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CheckResourcePermissionsRespDto.class); } /** * @summary 数组类型资源鉴权 * @description 数组类型资源鉴权,支持用户对一个或者多个数组资源进行权限判断 **/ public CheckResourcePermissionsRespDto checkPermissionByArrayResource(CheckPermissionArrayResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-permission-array-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CheckResourcePermissionsRespDto.class); } /** * @summary 树类型资源鉴权 * @description 树类型资源鉴权,支持用户对一个或者多个树资源进行权限判断 **/ public CheckResourcePermissionsRespDto checkPermissionByTreeResource(CheckPermissionTreeResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-permission-tree-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CheckResourcePermissionsRespDto.class); } /** * @summary 获取用户在登录应用下被授权资源列表 * @description 获取用户指定资源权限列表,用户获取在某个应用下所拥有的资源列表。 **/ public GetUserAuthResourceListRespDto getUserAuthorizedResourcesList() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-auth-resource-list"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetUserAuthResourceListRespDto.class); } /** * @summary 获取用户指定资源权限列表 * @description 获取用户指定资源的权限列表,用户获取某个应用下指定资源的权限列表。 **/ public GetUserAuthResourcePermissionListRespDto getUserAuthResourcePermissionList(GetUserAuthResourcePermissionListDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-auth-resource-permission-list"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetUserAuthResourcePermissionListRespDto.class); } /** * @summary 获取用户授权资源的结构列表 * @description 获取用户授权的资源列表,用户获取某个应用下的某个资源所授权的结构列表,通过不同的资源类型返回对应资源的授权列表。 **/ public GetUserAuthResourceStructRespDto getUserAuthResourceStruct(GetUserAuthResourceStructDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-auth-resource-struct"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetUserAuthResourceStructRespDto.class); } /** * @summary 获取 WebAuthn 认证请求初始化参数 * @description 获取 WebAuthn 认证请求初始化参数 **/ public GetAuthenticationOptionsRespDto initAuthenticationOptions() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/webauthn/authentication"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetAuthenticationOptionsRespDto.class); } /** * @summary 验证 WebAuthn 认证请求凭证 * @description 验证 WebAuthn 认证请求凭证 **/ public VerifyAuthenticationResultRespDto verifyAuthentication(VerifyAuthenticationDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/webauthn/authentication"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, VerifyAuthenticationResultRespDto.class); } /** * @summary 获取 webauthn 凭证创建初始化参数 * @description 获取 webauthn 凭证创建初始化参数。**此接口要求具备用户的登录态** **/ public GetRegistrationOptionsRespDto initRegisterOptions() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/webauthn/registration"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetRegistrationOptionsRespDto.class); } /** * @summary 验证 webauthn 绑定注册认证器凭证 * @description 验证 webauthn 绑定注册认证器凭证 **/ public VerifyRegistrationResultRespDto verifyRegister(VerifyRegistrationDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/webauthn/registration"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, VerifyRegistrationResultRespDto.class); } /** * @summary 我的设备列表 * @description 我登录过的设备列表。 **/ public TerminalSessionRespDto list(ListDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/mydevices/list"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TerminalSessionRespDto.class); } /** * @summary 移除设备 * @description 移除某个设备。 **/ public CommonResponseDto unbind(UnbindDeviceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/mydevices/unbind"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 从设备上退出登录 * @description 移除某个已登录设备的登录态。 **/ public CommonResponseDto revoke(RevokeDeviceSessionDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/mydevices/revoke-session"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 验证账号密码是否正确 * @description 验证账号密码是否正确,手机号、邮箱、用户名如果同时传递,优先级为邮箱 -> 手机号 -> 用户名。 **/ public ValidatePasswordRespDto validatePassword(ValidatePasswordDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/validate-password"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ValidatePasswordRespDto.class); } /** * @summary 微信移动端登录 * @description 移动端应用:使用微信作为外部身份源登录。 **/ public LoginTokenResponseDataDto authByCodeIdentity(WechatMobileAuthByCodeIdentityInput reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v2/ecConn/wechatMobile/authByCodeIdentity"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, LoginTokenResponseDataDto.class); } /** * @summary 微信移动端:使用身份源中用户信息 * @description 询问绑定开启时:绑定到外部身份源,根据外部身份源中的用户信息创建用户后绑定到当前身份源并登录。 **/ public WechatLoginTokenRespDto registerNewUser(BindByRegiserInputApi reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v2/ecConn/wechatMobile/register"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, WechatLoginTokenRespDto.class); } /** * @summary 微信移动端:邮箱验证码模式 * @description 询问绑定开启时:绑定到外部身份源,根据输入的邮箱验证用户信息,找到对应的用户后绑定到当前身份源并登录;找不到时报错“用户不存在”。 **/ public WechatLoginTokenRespDto bindByEmailCode(BindByEmailCodeInputApi reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v2/ecConn/wechatMobile/byEmailCode"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, WechatLoginTokenRespDto.class); } /** * @summary 微信移动端:手机号验证码模式 * @description 询问绑定开启时:绑定到外部身份源,根据输入的手机验证用户信息,找到对应的用户后绑定到当前身份源并登录;找不到时报错“用户不存在”。 **/ public WechatLoginTokenRespDto bindByPhoneCode(BindByPhoneCodeInputApi reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v2/ecConn/wechatMobile/byPhoneCode"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, WechatLoginTokenRespDto.class); } /** * @summary 微信移动端:账号密码模式 * @description 询问绑定开启时:绑定到外部身份源,根据输入的账号(用户名/手机号/邮箱)密码验证用户信息,找到对应的用户后绑定到当前身份源并登录;找不到时报错“用户不存在”。 **/ public WechatLoginTokenRespDto bindByAccount(BindByAccountInputApi reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v2/ecConn/wechatMobile/byAccount"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, WechatLoginTokenRespDto.class); } /** * @summary 微信移动端:多账号场景 * @description 询问绑定开启时:根据选择的账号绑定外部身份源,根据输入的账号 ID 验证用户信息,找到对应的用户后绑定到当前身份源并登录;找不到时报错“用户不存在”。 **/ public WechatLoginTokenRespDto selectAccount(BindByAccountsInputApi reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v2/ecConn/wechatMobile/select"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, WechatLoginTokenRespDto.class); } /** * @summary 微信移动端:账号 ID 模式 * @description 询问绑定开启时:绑定到外部身份源,根据输入的账号 ID 验证用户信息,找到对应的用户后绑定到当前身份源并登录;找不到时报错“用户不存在”。 **/ public WechatLoginTokenRespDto bindByAccountId(BindByAccountIdInputApi reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v2/ecConn/wechatMobile/byAccountId"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, WechatLoginTokenRespDto.class); } /** * @summary 获取推送登录请求关联的客户端应用 * @description 此端点用于在 Authing 令牌 APP 收到推送登录通知时,可检查当前用户登录的应用是否支持对推送登录请求进行授权。 **/ public GetPushCodeRelationAppsRespDto getPushLoginRelationApps(GetPushCodeRelationAppsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-pushlogin-relation-apps"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetPushCodeRelationAppsRespDto.class); } /** * @summary 获取快速认证二维码数据 * @description 此端点用于在用户个人中心,获取快速认证参数生成二维码,可使用 Authing 令牌 APP 扫码,完成快速认证。**此接口要求具备用户的登录态**。 **/ public GeneFastpassQRCodeRespDto geneFastpassQrcodeInfo(SignInFastpassDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/gene-fastpass-qrcode-info"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GeneFastpassQRCodeRespDto.class); } /** * @summary 获取快速认证的应用列表 * @description 此端点用于使用 Authing 令牌 APP 扫「用户个人中心」-「快速认证」二维码后,拉取可快速认证的客户端应用列表。 **/ public GetFastpassQRCodeRelationAppsRespDto getFastpassParams(GetFastpassClientAppsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-fastpass-client-apps"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetFastpassQRCodeRelationAppsRespDto.class); } /** * @summary 查询个人中心「快速认证二维码」的状态 * @description 按照用户扫码顺序,共分为未扫码、已扫码、已登录、二维码过期以及未知错误五种状态,前端应该通过不同的状态给到用户不同的反馈。 **/ public CheckQRCodeStatusRespDto getQrCodeStatus(GetAppLoginQrcodeStatusDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-app-login-qrcode-status"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CheckQRCodeStatusRespDto.class); } /** * @summary APP 端扫码登录 * @description 此端点用于在授权使 APP 成功扫码登录中,对应着在「个人中心」-「快速认证」页面渲染出二维码,终端用户扫码并成功登录的过程。 **/ public LoginTokenRespDto qrCodeAppLogin(AppQRCodeLoginDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/qrcode-app-login"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, LoginTokenRespDto.class); } /** * @summary 预检验验证码是否正确 * @description 预检测验证码是否有效,此检验不会使得验证码失效。 **/ public PreCheckCodeRespDto preCheckCode(PreCheckCodeDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/pre-check-code"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PreCheckCodeRespDto.class); } /** **/ public ListWebAuthnAuthenticatorDeviceDataDto listCredentialsByPage(ListDeviceCredentialDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/webauthn/page-authenticator-device"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ListWebAuthnAuthenticatorDeviceDataDto.class); } /** **/ public WebAuthnCheckValidCredentialsByCredIdsRespDto checkValidCredentialsByCredIds(CheckDeviceCredentialIdDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/webauthn/check-valid-credentials-by-credIds"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, WebAuthnCheckValidCredentialsByCredIdsRespDto.class); } /** **/ public IsSuccessRespDto removeAllCredentials(RemoveDeviceCredentialDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/webauthn/remove-credentials-by-authenticator-code"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** **/ public IsSuccessRespDto removeCredential(WebAuthnRemoveCredentialDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/webauthn/remove-credential/{credentialID}"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 验证 MFA Token * @description 验证 MFA Token **/ public MfaTokenIntrospectResponse verifyMfaToken(MfaTokenIntrospectEndpointParams reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/mfa/token/introspection"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, MfaTokenIntrospectResponse.class); } /** * @summary 发起绑定 MFA 认证要素请求 * @description 当用户未绑定某个 MFA 认证要素时,可以发起绑定 MFA 认证要素请求。不同类型的 MFA 认证要素绑定请求需要发送不同的参数,详细见 profile 参数。发起验证请求之后,Authing 服务器会根据相应的认证要素类型和传递的参数,使用不同的手段要求验证。此接口会返回 enrollmentToken,你需要在请求「绑定 MFA 认证要素」接口时带上此 enrollmentToken,并提供相应的凭证。 **/ public SendEnrollFactorRequestRespDto sendEnrollFactorRequest(SendEnrollFactorRequestDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/send-enroll-factor-request"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, SendEnrollFactorRequestRespDto.class); } /** * @summary 绑定 MFA 认证要素 * @description 绑定 MFA 要素。 **/ public EnrollFactorRespDto enrollFactor(EnrollFactorDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/enroll-factor"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, EnrollFactorRespDto.class); } /** * @summary 解绑 MFA 认证要素 * @description 根据 Factor ID 解绑用户绑定的某个 MFA 认证要素。 **/ public ResetFactorRespDto resetFactor(ResetFactorDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/reset-factor"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ResetFactorRespDto.class); } /** * @summary 获取绑定的所有 MFA 认证要素 * @description Authing 目前支持四种类型的 MFA 认证要素:手机短信、邮件验证码、OTP、人脸。 **/ public ListEnrolledFactorsRespDto listEnrolledFactors() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-enrolled-factors"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, ListEnrolledFactorsRespDto.class); } /** * @summary 获取绑定的某个 MFA 认证要素 * @description 根据 Factor ID 获取用户绑定的某个 MFA Factor 详情。 **/ public GetFactorRespDto getFactor(GetFactorDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-factor"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetFactorRespDto.class); } /** * @summary 获取可绑定的 MFA 认证要素 * @description 获取所有应用已经开启、用户暂未绑定的 MFA 认证要素,用户可以从返回的列表中绑定新的 MFA 认证要素。 **/ public ListFactorsToEnrollRespDto listFactorsToEnroll() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-factors-to-enroll"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, ListFactorsToEnrollRespDto.class); } /** * @summary 校验用户 MFA 绑定的 OTP * @description 校验用户 MFA 绑定的 OTP。 **/ public MfaOtpVerityRespDto mfaOtpVerify(MfaOtpVerityDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/mfa-totp-verify"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, MfaOtpVerityRespDto.class); } // ==== AUTO GENERATED AUTHENTICATION METHODS END ==== @Override public void subEvent(String eventCode, Receiver receiver) { if (StrUtil.isBlank(eventCode)) { throw new IllegalArgumentException("eventCode is required"); } if (receiver == null) { throw new IllegalArgumentException("receiver is required"); } Assert.notNull(this.options.getAccessToken()); AuthenticationClientOptions options = (AuthenticationClientOptions) this.options; String eventUri = options.getWebSocketHost() + options.getWebSocketEndpoint() + "?code=" + eventCode + "&token=" + this.options.getAccessToken(); URI wssUri = null; try { wssUri = new URI(eventUri); } catch (URISyntaxException e) { throw new RuntimeException(e); } HashMap<String, String> headers = new HashMap(); AuthingWebsocketClient client = new AuthingWebsocketClient(wssUri, headers, receiver); client.connect(); } public CommonResponseDto pubtEvent(String eventCode, Object data) { Assert.notNull(eventCode); Assert.notNull(data); AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/pub-userEvent"); config.setBody(new EventDto(eventCode, data)); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * 生成图形验证码 * @return */ public CaptchaCodeRespDto getCaptchaCode() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-captcha-code"); config.setMethod("GET"); String response = request(config); return deserialize(response, CaptchaCodeRespDto.class); } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/client/BaseClient.java
package ai.genauth.sdk.java.client; import ai.genauth.sdk.java.model.AuthingClientOptions; import ai.genauth.sdk.java.model.AuthingRequestConfig; import ai.genauth.sdk.java.util.JsonUtils; import ai.genauth.sdk.java.model.Receiver; /** * @author luojielin */ public class BaseClient { protected AuthingClientOptions options; public BaseClient(AuthingClientOptions options) { this.options = options; } public static <T> T deserialize(String content, Class<T> valueType) { return JsonUtils.deserialize(content, valueType); } public static String serialize(Object value) { return JsonUtils.serialize(value); } public String request(AuthingRequestConfig config) { return options.doRequest(config.getUrl(), config.getMethod(), config.getHeaders(), config.getBody()); } public void subEvent(String eventCode, Receiver receiver){ } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/client/ManagementClient.java
package ai.genauth.sdk.java.client; import ai.genauth.sdk.java.dto.*; import ai.genauth.sdk.java.model.AuthingRequestConfig; import ai.genauth.sdk.java.model.AuthingWebsocketClient; import ai.genauth.sdk.java.model.ManagementClientOptions; import ai.genauth.sdk.java.model.Receiver; import ai.genauth.sdk.java.util.signature.Impl.SignatureComposer; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; public class ManagementClient extends BaseClient { public ManagementClient(ManagementClientOptions options) { super(options); // 必要参数校验 if (StrUtil.isBlank(options.getAccessKeyId())) { throw new IllegalArgumentException("accessKeyId is required"); } if (StrUtil.isBlank(options.getAccessKeySecret())) { throw new IllegalArgumentException("accessKeySecret is required"); } } public Object makeRequest(MakeRequestReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl(reqDto.getUrl()); config.setBody(reqDto.getData()); config.setMethod(reqDto.getMethod()); String response = request(config); return deserialize(response, Object.class); } /** * @summary 岗位列表 * @description 岗位列表 **/ public PostPaginatedRespDto postList(ListPostDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-post"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PostPaginatedRespDto.class); } /** * @summary 获取岗位 * @description 获取岗位 **/ public CreatePostDto getPost(GetPostDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-post"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CreatePostDto.class); } /** * @deprecated * @summary 获取用户关联岗位 * @description 获取用户关联的所有岗位 **/ public PostListRespDto getUserPosts(GetUserPostsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-posts"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PostListRespDto.class); } /** * @deprecated * @summary 获取用户关联岗位 * @description 此接口只会返回一个岗位,已废弃,请使用 /api/v3/get-user-posts 接口 **/ public CreatePostDto getUserPost(GetUserPostDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-post"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CreatePostDto.class); } /** * @summary 获取岗位信息 * @description 根据岗位 id 获取岗位详情 **/ public PostRespDto getPostById(GetPostByIdListDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-post-by-id"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PostRespDto.class); } /** * @summary 创建岗位 * @description 创建岗位 **/ public CreatePostRespDto createPost(CreatePostDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-post"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreatePostRespDto.class); } /** * @summary 更新岗位信息 * @description 更新岗位信息 **/ public CreatePostRespDto updatePost(CreatePostDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-post"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreatePostRespDto.class); } /** * @summary 删除岗位 * @description 删除岗位 **/ public CommonResponseDto removePost(RemovePostDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/remove-post"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 用户设置岗位 * @description 一次性给用户设置岗位:如果之前的岗位不在传入的列表中,会进行移除;如果有新增的岗位,会加入到新的岗位;如果不变,则不进行任何操作。 **/ public CommonResponseDto setUserPosts(SetUserPostsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-user-posts"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 用户关联岗位 * @description 用户关联岗位 **/ public CommonResponseDto userConnectionPost(UserConnectionPostDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/user-connection-post"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 数据对象高级搜索 * @description 数据对象高级搜索 **/ public FunctionModelValueListResDto listRow(FilterDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/filter"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, FunctionModelValueListResDto.class); } /** * @summary 获取数据对象行信息 * @description 获取数据对象行信息 **/ public FunctionModelValueResDto getRow(GetRowDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/get-row"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, FunctionModelValueResDto.class); } /** * @summary 根据属性值获取数据对象行信息 * @description 根据属性值获取数据对象行信息,只允许通过唯一性字段进行精确查询。 **/ public FunctionModelValueResDto getRowByValue(GetRowByValueDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/get-row-by-value"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, FunctionModelValueResDto.class); } /** * @summary 批量获取行信息 * @description 批量获取行信息 **/ public MetadataListResDto getRowBatch(GetRowBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/get-row-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, MetadataListResDto.class); } /** * @summary 添加行 * @description 添加行 **/ public FunctionModelValueResDto createRow(CreateRowDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/create-row"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, FunctionModelValueResDto.class); } /** * @summary 更新行 * @description 更新行 **/ public FunctionModelValueResDto updateRow(UpdateRowDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/update-row"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, FunctionModelValueResDto.class); } /** * @summary 删除行 * @description 删除行 **/ public CommonResponseDto removeRow(RemoveRowDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/remove-row"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 创建数据对象 * @description 利用此接口可以创建一个自定义的数据对象,定义数据对象的基本信息 **/ public FunctionModelResDto createModel(CreateFunctionModelDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/create-model"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, FunctionModelResDto.class); } /** * @summary 获取数据对象详情 * @description 利用功能 id ,获取数据对象的详细信息 **/ public FunctionModelResDto getModel(GetModelDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/get-model"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, FunctionModelResDto.class); } /** * @summary 获取数据对象列表 * @description 获取数据对象列表 **/ public FunctionModelListDto listModel() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/list-model"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, FunctionModelListDto.class); } /** * @summary 删除数据对象 * @description 根据请求的功能 id ,删除对应的数据对象 **/ public CommonResponseDto removeModel(FunctionModelIdDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/remove-model"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 更新数据对象 * @description 更新对应功能 id 的数据对象信息 **/ public FunctionModelResDto updateModel(UpdateFunctionModelDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/update-model"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, FunctionModelResDto.class); } /** * @summary 创建数据对象的字段 * @description 创建相关数据对象的字段,配置字段信息及基本校验规则 **/ public FunctionModelFieldResDto createField(CreateFunctionModelFieldDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/create-field"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, FunctionModelFieldResDto.class); } /** * @summary 更新数据对象的字段 * @description 更新相关数据对象的字段信息及基本校验规则 **/ public FunctionModelFieldResDto updateField(UpdateFunctionModelFieldDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/update-field"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, FunctionModelFieldResDto.class); } /** * @summary 删除数据对象的字段 * @description 根据功能字段 id 、功能 id 、字段属性名删除对应的字段 **/ public CommonResponseDto remoteField(FunctionModelFieldIdDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/remove-field"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取数据对象字段列表 * @description 获取数据对象字段列表 **/ public FunctionFieldListResDto listField(ListFieldDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/list-field"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, FunctionFieldListResDto.class); } /** * @summary 导出全部数据 * @description 导出全部数据 **/ public CommonResponseDto exportMeatdata(ExportModelDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/export"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 导入数据 * @description 导入数据 **/ public CommonResponseDto importMetadata(ImportModelDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/import"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取导入模板 * @description 获取导入模板 **/ public GetImportTemplateResDto getImportTemplate(GetImportTemplateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/get-import-template"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetImportTemplateResDto.class); } /** * @summary 创建自定义操作 * @description 创建自定义操作 **/ public CommonResponseDto createOperate(CreateOperateModelDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/create-operate"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 移除自定义操作 * @description 移除自定义操作 **/ public CommonResponseDto removeOperate(FunctionModelOperateIdDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/remove-operate"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 执行自定义操作 * @description 执行自定义操作 **/ public CommonResponseDto executeOperate(FunctionModelOperateIdDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/execute-operate"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 复制自定义操作 * @description 复制自定义操作 **/ public CommonResponseDto copyOperate(FunctionModelOperateIdDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/copy-operate"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 操作管理列表(分页) * @description 操作管理列表(分页) **/ public OperateModelDto listOperate(ListOperateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/list-operate"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, OperateModelDto.class); } /** * @summary 全部操作管理列表 * @description 全部操作管理列表 **/ public OperateModelDto listOperateAll(AllOperateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/all-operate"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, OperateModelDto.class); } /** * @summary 更新操作管理 * @description 更新操作管理 **/ public CommonResponseDto updateOperate(UpdateOperateModelDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/update-operate"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取关联数据详情 * @description 获取关联数据详情 **/ public CommonResponseDto getRelationInfo(GetRelationInfoDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/get-relation-info"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 创建行关联数据 * @description 创建行关联数据 **/ public CommonResponseDto createRowRelation(CreateRelationValueDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/create-row-relation"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取行关联数据 * @description 获取行关联数据 **/ public RelationValueListResDto getRelationValue(GetRowRelationDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/get-row-relation"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, RelationValueListResDto.class); } /** * @summary 删除行关联数据 * @description 删除行关联数据 **/ public CommonResponseDto removeRelationValue(RemoveRelationValueDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/remove-row-relation"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 导出数据对象 * @description 导出数据对象 **/ public CommonResponseDto exportModel(ExportMetadataDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/export/model"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 导入数据对象 * @description 导入数据对象 **/ public CommonResponseDto importModel(ImportMetadataDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/import/model"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取全部数据对象数据 * @description 获取全部数据对象数据 **/ public FunctionModelValueListResDto getAllMetadata(GetAllRowDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/get-all-metadata"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, FunctionModelValueListResDto.class); } /** * @summary 获取行关联数据 * @description 获取行关联数据 **/ public RelationValueListResDto getRelationDetails() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/get-row-relation-details"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, RelationValueListResDto.class); } /** * @summary UEBA 上传 * @description UEBA 上传 **/ public CreateUEBARespDto capture(CreateUEBADto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/metadata/ueba/capture"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateUEBARespDto.class); } /** * @summary 移除绑定(用户详情页) * @description 移除绑定(用户详情页)。 **/ public CommonResponseDto deleteDevice(DeleteTerminalUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-device-by-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 挂起设备(用户详情页) * @description 挂起设备(用户详情页)。 **/ public CommonResponseDto suspendDevice(SuspendTerminalUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/suspend-device-by-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 停用设备(用户详情页) * @description 停用设备(用户详情页)。 **/ public CommonResponseDto disableDevice(UpdateTerminalUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/disable-device-by-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 启用设备(用户详情页) * @description 启用设备(用户详情页)。 **/ public CommonResponseDto enableDevice(UpdateTerminalUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/enable-device-by-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取设备状态 * @description 获取设备状态。 **/ public DeviceStatusRespDto getDeviceStatus(TerminalBaseDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/device-status"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, DeviceStatusRespDto.class); } /** * @summary 获取/搜索公共账号列表 * @description * 此接口用于获取用户列表,支持模糊搜索,以及通过用户基础字段、用户自定义字段、用户所在部门、用户历史登录应用等维度筛选用户。 * * ### 模糊搜素示例 * * 模糊搜索默认会从 `phone`, `email`, `name`, `username`, `nickname` 五个字段对用户进行模糊搜索,你也可以通过设置 `options.fuzzySearchOn` * 决定模糊匹配的字段范围: * * ```json * { * "keywords": "北京", * "options": { * "fuzzySearchOn": [ * "address" * ] * } * } * ``` * * ### 高级搜索示例 * * 你可以通过 `advancedFilter` 进行高级搜索,高级搜索支持通过用户的基础信息、自定义数据、所在部门、用户来源、登录应用、外部身份源信息等维度对用户进行筛选。 * **且这些筛选条件可以任意组合。** * * #### 筛选状态为禁用的用户 * * 用户状态(`status`)为字符串类型,可选值为 `Activated` 和 `Suspended`: * * ```json * { * "advancedFilter": [ * { * "field": "status", * "operator": "EQUAL", * "value": "Suspended" * } * ] * } * ``` * * #### 筛选邮箱中包含 `@example.com` 的用户 * * 用户邮箱(`email`)为字符串类型,可以进行模糊搜索: * * ```json * { * "advancedFilter": [ * { * "field": "email", * "operator": "CONTAINS", * "value": "@example.com" * } * ] * } * ``` * * #### 根据用户的任意扩展字段进行搜索 * * ```json * { * "advancedFilter": [ * { * "field": "some-custom-key", * "operator": "EQUAL", * "value": "some-value" * } * ] * } * ``` * * #### 根据用户登录次数筛选 * * 筛选登录次数大于 10 的用户: * * ```json * { * "advancedFilter": [ * { * "field": "loginsCount", * "operator": "GREATER", * "value": 10 * } * ] * } * ``` * * 筛选登录次数在 10 - 100 次的用户: * * ```json * { * "advancedFilter": [ * { * "field": "loginsCount", * "operator": "BETWEEN", * "value": [10, 100] * } * ] * } * ``` * * #### 根据用户上次登录时间进行筛选 * * 筛选最近 7 天内登录过的用户: * * ```json * { * "advancedFilter": [ * { * "field": "lastLoginTime", * "operator": "GREATER", * "value": new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) * } * ] * } * ``` * * 筛选在某一段时间内登录过的用户: * * ```json * { * "advancedFilter": [ * { * "field": "lastLogin", * "operator": "BETWEEN", * "value": [ * Date.now() - 14 * 24 * 60 * 60 * 1000, * Date.now() - 7 * 24 * 60 * 60 * 1000 * ] * } * ] * } * ``` * * #### 根据用户曾经登录过的应用筛选 * * 筛选出曾经登录过应用 `appId1` 或者 `appId2` 的用户: * * ```json * { * "advancedFilter": [ * { * "field": "loggedInApps", * "operator": "IN", * "value": [ * "appId1", * "appId2" * ] * } * ] * } * ``` * * #### 根据用户所在部门进行筛选 * * ```json * { * "advancedFilter": [ * { * "field": "department", * "operator": "IN", * "value": [ * { * "organizationCode": "steamory", * "departmentId": "root", * "departmentIdType": "department_id", * "includeChildrenDepartments": true * } * ] * } * ] * } * ``` * * **/ public PublicAccountPaginatedRespDto listPublicAccounts(ListPublicAccountsRequestDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-public-accounts"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PublicAccountPaginatedRespDto.class); } /** * @summary 获取公共账号信息 * @description 通过公共账号用户 ID,获取公共账号详情,可以选择获取自定义数据、选择指定用户 ID 类型等。 **/ public PublicAccountSingleRespDto getPublicAccount(GetPublicAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-public-account"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PublicAccountSingleRespDto.class); } /** * @summary 批量获取公共账号信息 * @description 通过公共账号用户 ID 列表,批量获取公共账号信息,可以选择获取自定义数据、选择指定用户 ID 类型等。 **/ public PublicAccountListRespDto getPublicAccountBatch(GetPublicAccountBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-public-account-batch"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PublicAccountListRespDto.class); } /** * @summary 创建公共账号 * @description 创建公共账号,邮箱、手机号、用户名必须包含其中一个,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份创建公共账号用户因此不需要进行手机号验证码检验等安全检测。 **/ public PublicAccountSingleRespDto createPublicAccount(CreatePublicAccountReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-public-account"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PublicAccountSingleRespDto.class); } /** * @summary 批量创建公共账号 * @description 批量创建公共账号,邮箱、手机号、用户名必须包含其中一个,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份创建公共账号用户因此不需要进行手机号验证码检验等安全检测。 **/ public PublicAccountListRespDto createPublicAccountsBatch(CreatePublicAccountBatchReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-public-accounts-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PublicAccountListRespDto.class); } /** * @summary 修改公共账号资料 * @description 通过公共账号用户 ID,修改公共账号资料,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份修改公共账号资料因此不需要进行手机号验证码检验等安全检测。 **/ public PublicAccountSingleRespDto updatePublicAccount(UpdatePublicAccountReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-public-account"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PublicAccountSingleRespDto.class); } /** * @summary 批量修改公共账号资料 * @description 批量修改公共账号资料,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份修改公共账号资料因此不需要进行手机号验证码检验等安全检测。 **/ public PublicAccountListRespDto updatePublicAccountBatch(UpdatePublicAccountBatchReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-public-account-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PublicAccountListRespDto.class); } /** * @summary 批量删除公共账号 * @description 通过公共账号 ID 列表,删除公共账号,支持批量删除,可以选择指定用户 ID 类型等。 **/ public IsSuccessRespDto deletePublicAccountsBatch(DeletePublicAccountsBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-public-accounts-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 强制下线公共账号 * @description 通过公共账号 ID、App ID 列表,强制让公共账号下线,可以选择指定公共账号 ID 类型等。 **/ public IsSuccessRespDto kickPublicAccounts(KickPublicAccountsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/kick-public-accounts"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 个人账号转换为公共账号 * @description 通过用户 ID,把个人账号转换为公共账号。 **/ public CommonResponseDto changeIntoPublicAccount(CreatePublicAccountFromUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/transfer-into-public-account"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取用户的公共账号列表 * @description 通过用户 ID,获取用户的公共账号列表。 **/ public PublicAccountPaginatedRespDto getPublicAccountsOfUser(GetPublicAccountsOfUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-public-accounts-of-user"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PublicAccountPaginatedRespDto.class); } /** * @summary 公共账号的用户列表 * @description 通过公共账号 ID,获取用户列表。 **/ public PublicAccountPaginatedRespDto getUsersOfPublicAccount(GetUsersOfPublicAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-users-of-public-account"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PublicAccountPaginatedRespDto.class); } /** * @summary 公共账号绑定批量用户 * @description 使用公共账号绑定批量用户 **/ public IsSuccessRespDto bindUsersPublicAccount(SetPublicAccountBatchReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-public-account-of-users"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 用户绑定批量公共账号 * @description 用户绑定批量公共账号 **/ public IsSuccessRespDto setuserOfPublicAccount(SetUserOfPublicAccountBatchReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-user-of-public-accounts"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 公共账号解绑用户 * @description 公共账号解绑用户 **/ public IsSuccessRespDto unbindUsersPublicAccount(UnbindPublicAccountBatchReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/unbind-public-account-of-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取组织机构详情 * @description 获取组织机构详情 **/ public OrganizationSingleRespDto getOrganization(GetOrganizationDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-organization"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, OrganizationSingleRespDto.class); } /** * @summary 批量获取组织机构详情 * @description 批量获取组织机构详情 **/ public OrganizationListRespDto getOrganizationsBatch(GetOrganizationBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-organization-batch"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, OrganizationListRespDto.class); } /** * @summary 获取组织机构列表 * @description 获取组织机构列表,支持分页。 **/ public OrganizationPaginatedRespDto listOrganizations(ListOrganizationsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-organizations"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, OrganizationPaginatedRespDto.class); } /** * @summary 创建组织机构 * @description 创建组织机构,会创建一个只有一个节点的组织机构,可以选择组织描述信息、根节点自定义 ID、多语言等。 **/ public OrganizationSingleRespDto createOrganization(CreateOrganizationReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-organization"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, OrganizationSingleRespDto.class); } /** * @summary 修改组织机构 * @description 通过组织 code,修改组织机构,可以选择部门描述、新组织 code、组织名称等。 **/ public OrganizationSingleRespDto updateOrganization(UpdateOrganizationReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-organization"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, OrganizationSingleRespDto.class); } /** * @summary 删除组织机构 * @description 通过组织 code,删除组织机构树。 **/ public IsSuccessRespDto deleteOrganization(DeleteOrganizationReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-organization"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 搜索组织机构列表 * @description 通过搜索关键词,搜索组织机构列表,支持分页。 **/ public OrganizationPaginatedRespDto searchOrganizations(SearchOrganizationsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/search-organizations"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, OrganizationPaginatedRespDto.class); } /** * @summary 更新组织机构状态 **/ public IsSuccessRespDto updateOrganizationStatus(UpdateOrganizationStatusReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-organization-status"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取部门信息 * @description 通过组织 code 以及 部门 ID 或 部门 code,获取部门信息,可以获取自定义数据。 **/ public DepartmentSingleRespDto getDepartment(GetDepartmentDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-department"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, DepartmentSingleRespDto.class); } /** * @summary 创建部门 * @description 通过组织 code、部门名称、父部门 ID,创建部门,可以设置多种参数。 **/ public DepartmentSingleRespDto createDepartment(CreateDepartmentReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-department"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, DepartmentSingleRespDto.class); } /** * @summary 修改部门 * @description 通过组织 code、部门 ID,修改部门,可以设置多种参数。 **/ public DepartmentSingleRespDto updateDepartment(UpdateDepartmentReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-department"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, DepartmentSingleRespDto.class); } /** * @summary 删除部门 * @description 通过组织 code、部门 ID,删除部门。 **/ public IsSuccessRespDto deleteDepartment(DeleteDepartmentReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-department"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @deprecated * @summary 搜索部门 * @description 通过组织 code、搜索关键词,搜索部门,可以搜索组织名称等。 **/ public DepartmentListRespDto searchDepartments(SearchDepartmentsReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/search-departments"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, DepartmentListRespDto.class); } /** * @summary 搜索部门 * @description 通过组织 code、搜索关键词,搜索部门,可以搜索组织名称等。 **/ public DepartmentListRespDto searchDepartmentsList(SearchDepartmentsListReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/search-departments-list"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, DepartmentListRespDto.class); } /** * @summary 获取子部门列表 * @description 通过组织 code、部门 ID,获取子部门列表,可以选择获取自定义数据、虚拟组织等。 **/ public DepartmentPaginatedRespDto listChildrenDepartments(ListChildrenDepartmentsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-children-departments"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, DepartmentPaginatedRespDto.class); } /** * @summary 获取所有部门列表 * @description 获取所有部门列表,可以用于获取某个组织下的所有部门列表。 **/ public DepartmentPaginatedRespDto getAllDepartments(GetAllDepartmentsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-all-departments"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, DepartmentPaginatedRespDto.class); } /** * @summary 获取部门成员列表 * @description 通过组织 code、部门 ID、排序,获取部门成员列表,支持分页,可以选择获取自定义数据、identities 等。 **/ public UserPaginatedRespDto listDepartmentMembers(ListDepartmentMembersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-department-members"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserPaginatedRespDto.class); } /** * @summary 获取部门直属成员 ID 列表 * @description 通过组织 code、部门 ID,获取部门直属成员 ID 列表。 **/ public UserIdListRespDto listDepartmentMemberIds(ListDepartmentMemberIdsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-department-member-ids"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserIdListRespDto.class); } /** * @summary 搜索部门下的成员 * @description 通过组织 code、部门 ID、搜索关键词,搜索部门下的成员,支持分页,可以选择获取自定义数据、identities 等。 **/ public UserPaginatedRespDto searchDepartmentMembers(SearchDepartmentMembersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/search-department-members"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserPaginatedRespDto.class); } /** * @summary 部门下添加成员 * @description 通过部门 ID、组织 code,添加部门下成员。 **/ public IsSuccessRespDto addDepartmentMembers(AddDepartmentMembersReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/add-department-members"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 部门下删除成员 * @description 通过部门 ID、组织 code,删除部门下成员。 **/ public IsSuccessRespDto removeDepartmentMembers(RemoveDepartmentMembersReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/remove-department-members"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取父部门信息 * @description 通过组织 code、部门 ID,获取父部门信息,可以选择获取自定义数据等。 **/ public DepartmentSingleRespDto getParentDepartment(GetParentDepartmentDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-parent-department"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, DepartmentSingleRespDto.class); } /** * @summary 判断用户是否在某个部门下 * @description 通过组织 code、部门 ID,判断用户是否在某个部门下,可以选择包含子部门。 **/ public IsUserInDepartmentRespDto isUserInDepartment(IsUserInDepartmentDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/is-user-in-department"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, IsUserInDepartmentRespDto.class); } /** * @summary 根据部门id查询部门 * @description 根据部门id查询部门 **/ public DepartmentSingleRespDto getDepartmentById(GetDepartmentByIdDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-department-by-id"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, DepartmentSingleRespDto.class); } /** * @summary 根据组织树批量创建部门 * @description 根据组织树批量创建部门,部门名称不存在时会自动创建 **/ public CreateDepartmentTreeRespDto createDepartmentTree(CreateDepartmentTreeReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-department-tree"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateDepartmentTreeRespDto.class); } /** * @summary 获取部门绑定的第三方同步关系 * @description 如果在 Authing 中的部门进行了上下游同步,此接口可以用于查询出在第三方的关联用户信息 **/ public SyncRelationListRespDto getDepartmentSyncRelations(GetDepartmentSyncRelationsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-department-sync-relations"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, SyncRelationListRespDto.class); } /** * @summary 删除部门同步关联关系 * @description 如果在 Authing 中的部门进行了上下游同步,此接口可以用于删除某个部门在指定身份源下的关联关系。 **/ public IsSuccessRespDto deleteDepartmentSyncRelations(DeleteDepartmentSyncRelationReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-department-sync-relations"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 更新部门状态 * @description 启用和禁用部门 **/ public Node updateNodeStatus(UpdateDepartmentStatusReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-department-status"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, Node.class); } /** * @summary 获取/搜索用户列表 * @description * 此接口用于获取用户列表,支持模糊搜索,以及通过用户基础字段、用户自定义字段、用户所在部门、用户历史登录应用等维度筛选用户。 * * ### 模糊搜素示例 * * 模糊搜索默认会从 `phone`, `email`, `name`, `username`, `nickname` 五个字段对用户进行模糊搜索,你也可以通过设置 `options.fuzzySearchOn` * 决定模糊匹配的字段范围: * * ```json * { * "keywords": "北京", * "options": { * "fuzzySearchOn": [ * "address" * ] * } * } * ``` * * ### 高级搜索示例 * * 你可以通过 `advancedFilter` 进行高级搜索,高级搜索支持通过用户的基础信息、自定义数据、所在部门、用户来源、登录应用、外部身份源信息等维度对用户进行筛选。 * **且这些筛选条件可以任意组合。** * * #### 筛选状态为禁用的用户 * * 用户状态(`status`)为字符串类型,可选值为 `Activated` 和 `Suspended`: * * ```json * { * "advancedFilter": [ * { * "field": "status", * "operator": "EQUAL", * "value": "Suspended" * } * ] * } * ``` * * #### 筛选邮箱中包含 `@example.com` 的用户 * * 用户邮箱(`email`)为字符串类型,可以进行模糊搜索: * * ```json * { * "advancedFilter": [ * { * "field": "email", * "operator": "CONTAINS", * "value": "@example.com" * } * ] * } * ``` * * #### 根据用户的任意扩展字段进行搜索 * * ```json * { * "advancedFilter": [ * { * "field": "some-custom-key", * "operator": "EQUAL", * "value": "some-value" * } * ] * } * ``` * * #### 根据用户登录次数筛选 * * 筛选登录次数大于 10 的用户: * * ```json * { * "advancedFilter": [ * { * "field": "loginsCount", * "operator": "GREATER", * "value": 10 * } * ] * } * ``` * * 筛选登录次数在 10 - 100 次的用户: * * ```json * { * "advancedFilter": [ * { * "field": "loginsCount", * "operator": "BETWEEN", * "value": [10, 100] * } * ] * } * ``` * * #### 根据用户上次登录时间进行筛选 * * 筛选最近 7 天内登录过的用户: * * ```json * { * "advancedFilter": [ * { * "field": "lastLoginTime", * "operator": "GREATER", * "value": new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) * } * ] * } * ``` * * 筛选在某一段时间内登录过的用户: * * ```json * { * "advancedFilter": [ * { * "field": "lastLogin", * "operator": "BETWEEN", * "value": [ * Date.now() - 14 * 24 * 60 * 60 * 1000, * Date.now() - 7 * 24 * 60 * 60 * 1000 * ] * } * ] * } * ``` * * #### 根据用户曾经登录过的应用筛选 * * 筛选出曾经登录过应用 `appId1` 或者 `appId2` 的用户: * * ```json * { * "advancedFilter": [ * { * "field": "loggedInApps", * "operator": "IN", * "value": [ * "appId1", * "appId2" * ] * } * ] * } * ``` * * #### 根据用户所在部门进行筛选 * * ```json * { * "advancedFilter": [ * { * "field": "department", * "operator": "IN", * "value": [ * { * "organizationCode": "steamory", * "departmentId": "root", * "departmentIdType": "department_id", * "includeChildrenDepartments": true * } * ] * } * ] * } * ``` * * **/ public UserPaginatedRespDto listUsers(ListUsersRequestDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-users"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UserPaginatedRespDto.class); } /** * @deprecated * @summary 获取用户列表 * @description 获取用户列表接口,支持分页,可以选择获取自定义数据、identities 等。 **/ public UserPaginatedRespDto listUsersLegacy(ListUsersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-users"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserPaginatedRespDto.class); } /** * @summary 获取用户信息 * @description 通过用户 ID,获取用户详情,可以选择获取自定义数据、identities、选择指定用户 ID 类型等。 **/ public UserSingleRespDto getUser(GetUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserSingleRespDto.class); } /** * @summary 批量获取用户信息 * @description 通过用户 ID 列表,批量获取用户信息,可以选择获取自定义数据、identities、选择指定用户 ID 类型等。 **/ public UserListRespDto getUserBatch(GetUserBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-batch"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserListRespDto.class); } /** * @summary 用户属性解密 * @description 接口接收加密信息,返回解密信息 **/ public UserFieldDecryptRespDto userFieldDecrypt(UserFieldDecryptReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/users/field/decrypt"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UserFieldDecryptRespDto.class); } /** * @summary 创建用户 * @description 创建用户,邮箱、手机号、用户名必须包含其中一个,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份创建用户因此不需要进行手机号验证码检验等安全检测。 **/ public UserSingleRespDto createUser(CreateUserReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UserSingleRespDto.class); } /** * @summary 批量创建用户 * @description 批量创建用户,邮箱、手机号、用户名必须包含其中一个,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份创建用户因此不需要进行手机号验证码检验等安全检测。 **/ public UserListRespDto createUsersBatch(CreateUserBatchReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-users-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UserListRespDto.class); } /** * @summary 修改用户资料 * @description 通过用户 ID,修改用户资料,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份修改用户资料因此不需要进行手机号验证码检验等安全检测。 **/ public UserSingleRespDto updateUser(UpdateUserReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UserSingleRespDto.class); } /** * @summary 批量修改用户资料 * @description 批量修改用户资料,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份修改用户资料因此不需要进行手机号验证码检验等安全检测。 **/ public UserListRespDto updateUserBatch(UpdateUserBatchReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-user-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UserListRespDto.class); } /** * @summary 批量删除用户 * @description 通过用户 ID 列表,删除用户,支持批量删除,可以选择指定用户 ID 类型等。 **/ public IsSuccessRespDto deleteUsersBatch(DeleteUsersBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-users-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取用户的外部身份源 * @description 通过用户 ID,获取用户的外部身份源、选择指定用户 ID 类型。 **/ public IdentityListRespDto getUserIdentities(GetUserIdentitiesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-identities"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, IdentityListRespDto.class); } /** * @summary 获取用户角色列表 * @description 通过用户 ID,获取用户角色列表,可以选择所属权限分组 code、选择指定用户 ID 类型等。注意:如果不传 namespace,默认只会获取默认权限分组下面的角色! **/ public RolePaginatedRespDto getUserRoles(GetUserRolesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-roles"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, RolePaginatedRespDto.class); } /** * @summary 获取用户实名认证信息 * @description 通过用户 ID,获取用户实名认证信息,可以选择指定用户 ID 类型。 **/ public PrincipalAuthenticationInfoPaginatedRespDto getUserPrincipalAuthenticationInfo(GetUserPrincipalAuthenticationInfoDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-principal-authentication-info"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PrincipalAuthenticationInfoPaginatedRespDto.class); } /** * @summary 删除用户实名认证信息 * @description 通过用户 ID,删除用户实名认证信息,可以选择指定用户 ID 类型等。 **/ public IsSuccessRespDto resetUserPrincipalAuthenticationInfo(ResetUserPrincipalAuthenticationInfoDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/reset-user-principal-authentication-info"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取用户部门列表 * @description 通过用户 ID,获取用户部门列表,支持分页,可以选择获取自定义数据、选择指定用户 ID 类型、增序或降序等。 **/ public UserDepartmentPaginatedRespDto getUserDepartments(GetUserDepartmentsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-departments"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserDepartmentPaginatedRespDto.class); } /** * @summary 设置用户所在部门 * @description 通过用户 ID,设置用户所在部门,可以选择指定用户 ID 类型等。 **/ public IsSuccessRespDto setUserDepartments(SetUserDepartmentsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-user-departments"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取用户分组列表 * @description 通过用户 ID,获取用户分组列表,可以选择指定用户 ID 类型等。 **/ public GroupPaginatedRespDto getUserGroups(GetUserGroupsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-groups"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GroupPaginatedRespDto.class); } /** * @summary 获取用户 MFA 绑定信息 * @description 通过用户 ID,获取用户 MFA 绑定信息,可以选择指定用户 ID 类型等。 **/ public UserMfaSingleRespDto getUserMfaInfo(GetUserMfaInfoDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-mfa-info"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserMfaSingleRespDto.class); } /** * @summary 获取已归档的用户列表 * @description 获取已归档的用户列表,支持分页,可以筛选开始时间等。 **/ public ListArchivedUsersSingleRespDto listArchivedUsers(ListArchivedUsersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-archived-users"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ListArchivedUsersSingleRespDto.class); } /** * @summary 强制下线用户 * @description 通过用户 ID、App ID 列表,强制让用户下线,可以选择指定用户 ID 类型等。 **/ public IsSuccessRespDto kickUsers(KickUsersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/kick-users"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 判断用户是否存在 * @description 根据条件判断用户是否存在,可以筛选用户名、邮箱、手机号、第三方外部 ID 等。 **/ public IsUserExistsRespDto isUserExists(IsUserExistsReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/is-user-exists"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsUserExistsRespDto.class); } /** * @summary 获取用户可访问的应用 * @description 通过用户 ID,获取用户可访问的应用,可以选择指定用户 ID 类型等。 **/ public AppListRespDto getUserAccessibleApps(GetUserAccessibleAppsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-accessible-apps"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, AppListRespDto.class); } /** * @summary 获取用户授权的应用 * @description 通过用户 ID,获取用户授权的应用,可以选择指定用户 ID 类型等。 **/ public AppListRespDto getUserAuthorizedApps(GetUserAuthorizedAppsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-authorized-apps"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, AppListRespDto.class); } /** * @summary 判断用户是否有某个角色 * @description 通过用户 ID,判断用户是否有某个角色,支持传入多个角色,可以选择指定用户 ID 类型等。 **/ public HasAnyRoleRespDto hasAnyRole(HasAnyRoleReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/has-any-role"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, HasAnyRoleRespDto.class); } /** * @summary 获取用户的登录历史记录 * @description 通过用户 ID,获取用户登录历史记录,支持分页,可以选择指定用户 ID 类型、应用 ID、开始与结束时间戳等。 **/ public UserLoginHistoryPaginatedRespDto getUserLoginHistory(GetUserLoginHistoryDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-login-history"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserLoginHistoryPaginatedRespDto.class); } /** * @summary 获取用户曾经登录过的应用 * @description 通过用户 ID,获取用户曾经登录过的应用,可以选择指定用户 ID 类型等。 **/ public UserLoggedInAppsListRespDto getUserLoggedinApps(GetUserLoggedinAppsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-loggedin-apps"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserLoggedInAppsListRespDto.class); } /** * @summary 获取用户曾经登录过的身份源 * @description 通过用户 ID,获取用户曾经登录过的身份源,可以选择指定用户 ID 类型等。 **/ public UserLoggedInIdentitiesRespDto getUserLoggedinIdentities(GetUserLoggedInIdentitiesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-logged-in-identities"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserLoggedInIdentitiesRespDto.class); } /** * @summary 离职用户 * @description 离职用户。离职操作会进行以下操作: * * - 离职后该成员授权、部门、角色、分组、岗位关系将被删除; * - 离职后将保留用户基本信息,同时账号将被禁用,无法登录应用;如果需要彻底删除账号,请调用删除接口。 * * 该操作不可恢复,请谨慎操作! * **/ public ResignUserRespDto resignUser(ResignUserReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/resign-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ResignUserRespDto.class); } /** * @summary 批量离职用户 * @description 批量离职用户。离职操作会进行以下操作: * * - 离职后该成员授权、部门、角色、分组、岗位关系将被删除; * - 离职后将保留用户基本信息,同时账号将被禁用,无法登录应用;如果需要彻底删除账号,请调用删除接口。 * * 该操作不可恢复,请谨慎操作! * **/ public ResignUserRespDto resignUserBatch(ResignUserBatchReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/resign-user-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ResignUserRespDto.class); } /** * @summary 获取用户被授权的所有资源 * @description 通过用户 ID,获取用户被授权的所有资源,可以选择指定用户 ID 类型等,用户被授权的资源是用户自身被授予、通过分组继承、通过角色继承、通过组织机构继承的集合。 **/ public AuthorizedResourcePaginatedRespDto getUserAuthorizedResources(GetUserAuthorizedResourcesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-authorized-resources"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, AuthorizedResourcePaginatedRespDto.class); } /** * @summary 检查某个用户在应用下是否具备 Session 登录态 * @description 检查某个用户在应用下是否具备 Session 登录态 **/ public CheckSessionStatusRespDto checkSessionStatus(CheckSessionStatusDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-session-status"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CheckSessionStatusRespDto.class); } /** * @summary 导入用户的 OTP * @description 导入用户的 OTP **/ public CommonResponseDto importOtp(ImportOtpReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/import-otp"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取用户绑定 OTP 的秘钥 * @description 通过用户 ID,获取用户绑定 OTP 的秘钥。可以选择指定用户 ID 类型等。 **/ public GetOtpSecretRespDto getOtpSecretByUser(GetOtpSecretByUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-otp-secret-by-user"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetOtpSecretRespDto.class); } /** * @summary 获取用户自定义加密的密码 * @description 此功能主要是用户在控制台配置加基于 RSA、SM2 等加密的密钥后,加密用户的密码。 **/ public GetUserPasswordCiphertextRespDto getUserPasswordCiphertext(GetUserPasswordCiphertextDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-password-ciphertext"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetUserPasswordCiphertextRespDto.class); } /** * @summary 给用户绑定一个身份信息 * @description 用户池管理员手动将来自外部身份源的身份信息绑定到用户上。绑定完成后,可以用执行过绑定操作的身份源登录到对应的 Authing 用户。 **/ public LinkIdentityResDto linkIdentity(LinkIdentityDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/link-identity"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, LinkIdentityResDto.class); } /** * @summary 解除绑定用户在身份源下的所有身份信息 * @description 解除绑定用户在某个身份源下的所有身份信息。解绑后,将无法使用执行过解绑操作的身份源登录到对应的 Authing 用户,除非重新绑定身份信息。 **/ public UnlinkIdentityResDto unlinkIdentity(UnlinkIdentity reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/unlink-identity"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UnlinkIdentityResDto.class); } /** * @summary 设置用户 MFA 状态 * @description 设置用户 MFA 状态,即 MFA 触发数据。 **/ public IsSuccessRespDto setUsersMfaStatus(SetMfaStatusDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-mfa-status"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取用户 MFA 状态 * @description 获取用户 MFA 状态,即 MFA 触发数据。 **/ public GetMapInfoRespDto getUserMfaStatus(GetMfaStatusDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-mfa-status"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetMapInfoRespDto.class); } /** * @summary 获取用户绑定的第三方同步关系 * @description 如果在 Authing 中的用户进行了上下游同步,此接口可以用于查询出在第三方的关联用户信息 **/ public SyncRelationListRespDto getUserSyncRelations(GetUserSyncRelationsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-sync-relations"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, SyncRelationListRespDto.class); } /** * @summary 删除用户同步关联关系 * @description 如果在 Authing 中的用户进行了上下游同步,此接口可以用于删除某个用户在指定身份源下的关联关系。 **/ public IsSuccessRespDto deleteUserSyncRelations(DeleteUserSyncRelationReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-user-sync-relations"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取公共账号的角色列表 * @description 通过用户 ID,获取用户角色列表,可以选择所属权限分组 code、选择指定用户 ID 类型等。 **/ public PublicAccountPaginatedRespDto getPublicAccountRoles(GetRolesOfPublicAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-roles-of-public-account"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PublicAccountPaginatedRespDto.class); } /** * @summary 获取角色的公共账号列表 * @description 通过角色 ID,获取用户的公共账号列表。 **/ public PublicAccountPaginatedRespDto getPublicAccountsOfRole(GetPublicAccountsOfRoleDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-public-accounts-of-role"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PublicAccountPaginatedRespDto.class); } /** * @summary 公共账号绑定批量角色 * @description 公共账号绑定批量角色 **/ public IsSuccessRespDto bindPublicAccountOfRoles(SetUserRolesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-public-account-of-roles"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取分组的公共账号列表 * @description 通过分组 ID,获取用户的公共账号列表。 **/ public PublicAccountPaginatedRespDto getPublicAccountsOfGroup(GetPublicAccountsOfGroupDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-public-accounts-of-group"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PublicAccountPaginatedRespDto.class); } /** * @summary 获取公共账号分组列表 * @description 通过公共账号 ID,获取公共账号分组列表,可以选择指定用户 ID 类型等。 **/ public GroupPaginatedRespDto getGroupsOfPublicAccount(GetGroupsOfPublicAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-groups-of-public-account"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GroupPaginatedRespDto.class); } /** * @summary 公共账号添加批量分组 * @description 公共账号通过分组 ID 添加批量分组 **/ public IsSuccessRespDto getPublicAccountOfGroups(SetUserGroupsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-public-account-of-groups"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取部门的公共账号列表 * @description 通过部门 ID,获取用户的公共账号列表。 **/ public PublicAccountPaginatedRespDto getPublicAccountsOfDepartment(GetPublicAccountsOfDepartmentDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-public-accounts-of-department"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PublicAccountPaginatedRespDto.class); } /** * @summary 获取公共账号的部门列表 * @description 通过用户 ID,获取用户部门列表,支持分页,可以选择获取自定义数据、选择指定用户 ID 类型、增序或降序等。 **/ public UserDepartmentPaginatedRespDto getPublicAccountDepartments(GetDepartmentsOfPublicAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-departments-of-public-account"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserDepartmentPaginatedRespDto.class); } /** * @summary 设置公共账号所在部门 * @description 设置公共账号所在部门。 **/ public IsSuccessRespDto setPublicAccountOfDepartments(SetUserDepartmentsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-public-account-of-departments"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量离职用户 * @description 批量离职用户。离职操作会进行以下操作: * * - 离职后该成员授权、部门、角色、分组、岗位关系将被删除; * - 离职后将保留用户基本信息,同时账号将被禁用,无法登录应用;如果需要彻底删除账号,请调用删除接口。 * * 该操作不可恢复,请谨慎操作! * **/ public ResignUserRespDto resignPublicAccountBatch(ResignUserBatchReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/resign-public-account-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ResignUserRespDto.class); } /** * @summary 获取公共账号的岗位 * @description 获取公共账号的岗位 **/ public CreatePostDto getPostOfPublicUser(GetPostOfPublicAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-post-of-public-account"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CreatePostDto.class); } /** * @summary 获取岗位的公共账号列表 * @description 通过岗位 ID,获取用户的公共账号列表。 **/ public PublicAccountPaginatedRespDto getPublicAccountsOfPost(GetPublicAccountsOfPostDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-public-accounts-of-post"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PublicAccountPaginatedRespDto.class); } /** * @summary 设置公共账号的岗位 * @description 设置公共账号关联的岗位 **/ public CommonResponseDto setPublicAccountOfnPost(UserConnectionPostDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-public-account-of-post"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 解绑公共账号关联岗位 * @description 解绑公共账号关联岗位 **/ public IsSuccessRespDto unbindPublicAccountOfPost(UserConnectionPostDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/unbind-public-account-of-post"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取同步任务详情 * @description 获取同步任务详情 **/ public SyncTaskSingleRespDto getSyncTask(GetSyncTaskDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-sync-task"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, SyncTaskSingleRespDto.class); } /** * @summary 获取同步任务列表 * @description 获取同步任务列表 **/ public SyncTaskPaginatedRespDto listSyncTasks(ListSyncTasksDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-sync-tasks"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, SyncTaskPaginatedRespDto.class); } /** * @summary 创建同步任务 * @description 创建同步任务 **/ public SyncTaskPaginatedRespDto createSyncTask(CreateSyncTaskDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-sync-task"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, SyncTaskPaginatedRespDto.class); } /** * @summary 修改同步任务 * @description 修改同步任务 **/ public SyncTaskPaginatedRespDto updateSyncTask(UpdateSyncTaskDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-sync-task"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, SyncTaskPaginatedRespDto.class); } /** * @summary 执行同步任务 * @description 执行同步任务 **/ public TriggerSyncTaskRespDto triggerSyncTask(TriggerSyncTaskDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/trigger-sync-task"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, TriggerSyncTaskRespDto.class); } /** * @summary 获取同步作业详情 * @description 获取同步作业详情 **/ public SyncJobSingleRespDto getSyncJob(GetSyncJobDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-sync-job"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, SyncJobSingleRespDto.class); } /** * @summary 获取同步作业详情 * @description 获取同步作业详情 **/ public SyncJobPaginatedRespDto listSyncJobs(ListSyncJobsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-sync-jobs"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, SyncJobPaginatedRespDto.class); } /** * @summary 获取同步作业详情 * @description 获取同步作业详情 **/ public TriggerSyncTaskRespDto listSyncJobLogs(ListSyncJobLogsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-sync-job-logs"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TriggerSyncTaskRespDto.class); } /** * @summary 获取同步风险操作列表 * @description 获取同步风险操作列表 **/ public SyncRiskOperationPaginatedRespDto listSyncRiskOperations(ListSyncRiskOperationsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-sync-risk-operations"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, SyncRiskOperationPaginatedRespDto.class); } /** * @summary 执行同步风险操作 * @description 执行同步风险操作 **/ public TriggerSyncRiskOperationsRespDto triggerSyncRiskOperations(TriggerSyncRiskOperationDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/trigger-sync-risk-operations"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, TriggerSyncRiskOperationsRespDto.class); } /** * @summary 取消同步风险操作 * @description 取消同步风险操作 **/ public CancelSyncRiskOperationsRespDto cancelSyncRiskOperation(CancelSyncRiskOperationDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/cancel-sync-risk-operation"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CancelSyncRiskOperationsRespDto.class); } /** * @summary 获取分组详情 * @description 通过分组 code,获取分组详情。 **/ public GroupSingleRespDto getGroup(GetGroupDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-group"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GroupSingleRespDto.class); } /** * @summary 获取分组列表 * @description 获取分组列表,支持分页。 **/ public GroupPaginatedRespDto listGroups(ListGroupsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-groups"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GroupPaginatedRespDto.class); } /** * @summary 获取所有分组 * @description 获取所有分组 **/ public GroupListRespDto getAllGroups(GetAllGroupsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-all-groups"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GroupListRespDto.class); } /** * @summary 创建分组 * @description 创建分组,一个分组必须包含分组名称与唯一标志符 code,且必须为一个合法的英文标志符,如 developers。 **/ public GroupSingleRespDto createGroup(CreateGroupReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-group"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GroupSingleRespDto.class); } /** * @summary 创建或修改分组 * @description 不存在时则创建,存在时则进行更新。 **/ public CreateOrUpdateGroupRespDto createOrUpdateGroup(CreateOrUpdateGroupReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-or-update-group"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateOrUpdateGroupRespDto.class); } /** * @summary 批量创建分组 * @description 批量创建分组,一个分组必须包含分组名称与唯一标志符 code,且必须为一个合法的英文标志符,如 developers。 **/ public GroupListRespDto createGroupsBatch(CreateGroupBatchReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-groups-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GroupListRespDto.class); } /** * @summary 修改分组 * @description 通过分组 code,修改分组,可以修改此分组的 code。 **/ public GroupSingleRespDto updateGroup(UpdateGroupReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-group"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GroupSingleRespDto.class); } /** * @summary 批量删除分组 * @description 通过分组 code,批量删除分组。 **/ public IsSuccessRespDto deleteGroupsBatch(DeleteGroupsReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-groups-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 添加分组成员 * @description 添加分组成员,成员以用户 ID 数组形式传递。 **/ public IsSuccessRespDto addGroupMembers(AddGroupMembersReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/add-group-members"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量移除分组成员 * @description 批量移除分组成员,成员以用户 ID 数组形式传递。 **/ public IsSuccessRespDto removeGroupMembers(RemoveGroupMembersReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/remove-group-members"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取分组成员列表 * @description 通过分组 code,获取分组成员列表,支持分页,可以获取自定义数据、identities、部门 ID 列表。 **/ public UserPaginatedRespDto listGroupMembers(ListGroupMembersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-group-members"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserPaginatedRespDto.class); } /** * @summary 获取分组被授权的资源列表 * @description 通过分组 code,获取分组被授权的资源列表,可以通过资源类型、权限分组 code 筛选。 **/ public AuthorizedResourceListRespDto getGroupAuthorizedResources(GetGroupAuthorizedResourcesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-group-authorized-resources"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, AuthorizedResourceListRespDto.class); } /** * @summary 获取角色详情 * @description 通过权限分组内角色 code,获取角色详情。 **/ public RoleSingleRespDto getRole(GetRoleDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-role"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, RoleSingleRespDto.class); } /** * @summary 单个角色批量授权 * @description 通过权限分组内角色 code,分配角色,被分配者可以是用户或部门。 **/ public IsSuccessRespDto assignRole(AssignRoleDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/assign-role"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量分配角色 * @description 批量分配角色,被分配者可以是用户,可以是部门 **/ public IsSuccessRespDto assignRoleBatch(AssignRoleBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/assign-role-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 移除分配的角色 * @description 通过权限分组内角色 code,移除分配的角色,被分配者可以是用户或部门。 **/ public IsSuccessRespDto revokeRole(RevokeRoleDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/revoke-role"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量移除分配的角色 * @description 批量移除分配的角色,被分配者可以是用户,可以是部门 **/ public IsSuccessRespDto revokeRoleBatch(RevokeRoleBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/revoke-role-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取角色被授权的资源列表 * @description 通过权限分组内角色 code,获取角色被授权的资源列表。 **/ public RoleAuthorizedResourcePaginatedRespDto getRoleAuthorizedResources(GetRoleAuthorizedResourcesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-role-authorized-resources"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, RoleAuthorizedResourcePaginatedRespDto.class); } /** * @summary 获取角色成员列表 * @description 通过权限分组内内角色 code,获取角色成员列表,支持分页,可以选择或获取自定义数据、identities 等。 **/ public UserPaginatedRespDto listRoleMembers(ListRoleMembersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-role-members"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserPaginatedRespDto.class); } /** * @summary 获取角色的部门列表 * @description 通过权限分组内角色 code,获取角色的部门列表,支持分页。 **/ public RoleDepartmentListPaginatedRespDto listRoleDepartments(ListRoleDepartmentsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-role-departments"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, RoleDepartmentListPaginatedRespDto.class); } /** * @summary 创建角色 * @description 通过权限分组(权限空间)内角色 code,创建角色,可以选择权限分组、角色描述、角色名称等。 **/ public RoleSingleRespDto createRole(CreateRoleDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-role"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, RoleSingleRespDto.class); } /** * @summary 获取角色列表 * @description 获取角色列表,支持分页、支持根据权限分组(权限空间)筛选 **/ public RolePaginatedRespDto listRoles(ListRolesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-roles"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, RolePaginatedRespDto.class); } /** * @summary 单个权限分组(权限空间)内删除角色 * @description 单个权限分组(权限空间)内删除角色,可以批量删除。 **/ public IsSuccessRespDto deleteRolesBatch(DeleteRoleDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-roles-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量创建角色 * @description 批量创建角色,可以选择权限分组、角色描述等。 **/ public IsSuccessRespDto createRolesBatch(CreateRolesBatch reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-roles-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 修改角色 * @description 通过权限分组(权限空间)内角色新旧 Code,修改角色,可以选择角色名称、角色描述等。 **/ public IsSuccessRespDto updateRole(UpdateRoleDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-role"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 跨权限分组(空间)删除角色 * @description 跨权限分组(空间)删除角色,可以批量删除。 **/ public IsSuccessRespDto deleteRoles(DeleteRoleBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/multiple-namespace-delete-roles-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 校验角色 Code 或者名称是否可用 * @description 通过用户池 ID、权限空间 Code和角色 Code,或者用户池 ID、权限空间名称和角色名称查询是否可用。 **/ public RoleCheckParamsRespDto checkParamsNamespace(CheckRoleParamsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-role-params"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, RoleCheckParamsRespDto.class); } /** * @summary 获取角色授权列表 * @description 获取角色授权列表。 **/ public RoleListPageRespDto listRoleAssignments(ListRoleAssignmentsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-role-assignments"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, RoleListPageRespDto.class); } /** * @summary 创建管理员角色 * @description 通过角色 code、角色名称进行创建管理员角色,可以选择角色描述 **/ public RoleCheckParamsRespDto createAdminRole(CreateAdminRoleDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-admin-role"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, RoleCheckParamsRespDto.class); } /** * @summary 删除管理员自定义角色 * @description 删除管理员自定义角色,支持批量删除。 **/ public IsSuccessRespDto deleteAdminRolesBatch(DeleteAdminRoleDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-admin-roles"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 检测角色互斥 * @description 检测一组角色是否存在互斥关系 **/ public CheckRoleMutualExclusionRespDto checkMutualExclusion(CheckRoleMutualExclusionReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-role-mutual-exclusion"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CheckRoleMutualExclusionRespDto.class); } /** * @summary 获取身份源列表 * @description 获取身份源列表,可以指定 租户 ID 筛选。 **/ public ExtIdpListPaginatedRespDto listExtIdp(ListExtIdpDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-ext-idp"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ExtIdpListPaginatedRespDto.class); } /** * @summary 获取身份源详情 * @description 通过 身份源 ID,获取身份源详情,可以指定 租户 ID 筛选。 **/ public ExtIdpDetailSingleRespDto getExtIdp(GetExtIdpDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-ext-idp"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ExtIdpDetailSingleRespDto.class); } /** * @summary 创建身份源 * @description 创建身份源,可以设置身份源名称、连接类型、租户 ID 等。 **/ public ExtIdpSingleRespDto createExtIdp(CreateExtIdpDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-ext-idp"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ExtIdpSingleRespDto.class); } /** * @summary 更新身份源配置 * @description 更新身份源配置,可以设置身份源 ID 与 名称。 **/ public ExtIdpSingleRespDto updateExtIdp(UpdateExtIdpDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-ext-idp"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ExtIdpSingleRespDto.class); } /** * @summary 删除身份源 * @description 通过身份源 ID,删除身份源。 **/ public IsSuccessRespDto deleteExtIdp(DeleteExtIdpDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-ext-idp"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 在某个已有身份源下创建新连接 * @description 在某个已有身份源下创建新连接,可以设置身份源图标、是否只支持登录等。 **/ public ExtIdpConnDetailSingleRespDto createExtIdpConn(CreateExtIdpConnDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-ext-idp-conn"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ExtIdpConnDetailSingleRespDto.class); } /** * @summary 更新身份源连接 * @description 更新身份源连接,可以设置身份源图标、是否只支持登录等。 **/ public ExtIdpConnDetailSingleRespDto updateExtIdpConn(UpdateExtIdpConnDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-ext-idp-conn"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ExtIdpConnDetailSingleRespDto.class); } /** * @summary 删除身份源连接 * @description 通过身份源连接 ID,删除身份源连接。 **/ public IsSuccessRespDto deleteExtIdpConn(DeleteExtIdpConnDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-ext-idp-conn"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 身份源连接开关 * @description 身份源连接开关,可以打开或关闭身份源连接。 **/ public IsSuccessRespDto changeExtIdpConnState(ChangeExtIdpConnStateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/change-ext-idp-conn-state"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 租户关联身份源 * @description 租户可以关联或取消关联身份源连接。 **/ public IsSuccessRespDto changeExtIdpConnAssociationState(ChangeExtIdpAssociationStateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/change-ext-idp-conn-association-state"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 租户控制台获取身份源列表 * @description 在租户控制台内获取身份源列表,可以根据 应用 ID 筛选。 **/ public ExtIdpListPaginatedRespDto listTenantExtIdp(ListTenantExtIdpDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-tenant-ext-idp"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ExtIdpListPaginatedRespDto.class); } /** * @summary 身份源下应用的连接详情 * @description 在身份源详情页获取应用的连接情况 **/ public ExtIdpListPaginatedRespDto extIdpConnStateByApps(ExtIdpConnAppsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/ext-idp-conn-apps"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ExtIdpListPaginatedRespDto.class); } /** * @summary 获取用户内置字段列表 * @description 获取用户内置的字段列表 **/ public CustomFieldListRespDto getUserBaseFields() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-base-fields"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, CustomFieldListRespDto.class); } /** * @summary 获取用户内置字段列表 * @description 获取用户内置的字段列表 **/ public ListCistomFieldsResDto listUserBaseFields(ListUserBaseFieldsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-user-base-fields"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ListCistomFieldsResDto.class); } /** * @summary 修改用户内置字段配置 * @description 修改用户内置字段配置,内置字段不允许修改数据类型、唯一性。 **/ public CustomFieldListRespDto setUserBaseFields(SetUserBaseFieldsReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-user-base-fields"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CustomFieldListRespDto.class); } /** * @summary 获取自定义字段列表 * @description 通过主体类型,获取用户、部门或角色的自定义字段列表。 **/ public CustomFieldListRespDto getCustomFields(GetCustomFieldsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-custom-fields"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CustomFieldListRespDto.class); } /** * @summary 获取自定义字段列表 * @description 通过主体类型,获取用户、部门或角色的自定义字段列表。 **/ public ListCistomFieldsResDto listCustFields(ListCustomFieldsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-custom-fields"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ListCistomFieldsResDto.class); } /** * @summary 创建/修改自定义字段定义 * @description 创建/修改用户、部门或角色自定义字段定义,如果传入的 key 不存在则创建,存在则更新。 **/ public CustomFieldListRespDto setCustomFields(SetCustomFieldsReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-custom-fields"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CustomFieldListRespDto.class); } /** * @summary 删除自定义字段定义 * @description 删除用户、部门或角色自定义字段定义。 **/ public IsSuccessRespDto deleteCustomFields(DeleteCustomFieldsReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-custom-fields"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 设置自定义字段的值 * @description 给用户、角色或部门设置自定义字段的值,如果存在则更新,不存在则创建。 **/ public IsSuccessRespDto setCustomData(SetCustomDataReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-custom-data"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取用户、分组、角色、组织机构的自定义字段值 * @description 通过筛选条件,获取用户、分组、角色、组织机构的自定义字段值。 **/ public GetCustomDataRespDto getCustomData(GetCustomDataDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-custom-data"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetCustomDataRespDto.class); } /** * @summary 创建资源 * @description 创建资源,可以设置资源的描述、定义的操作类型、URL 标识等。 **/ public ResourceRespDto createResource(CreateResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ResourceRespDto.class); } /** * @summary 批量创建资源 * @description 批量创建资源,可以设置资源的描述、定义的操作类型、URL 标识等。 **/ public IsSuccessRespDto createResourcesBatch(CreateResourcesBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-resources-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取资源详情 * @description 根据筛选条件,获取资源详情。 **/ public ResourceRespDto getResource(GetResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-resource"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ResourceRespDto.class); } /** * @summary 批量获取资源详情 * @description 根据筛选条件,批量获取资源详情。 **/ public ResourceListRespDto getResourcesBatch(GetResourcesBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-resources-batch"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ResourceListRespDto.class); } /** * @summary 分页获取常规资源列表 * @description 根据筛选条件,分页获取常规资源详情列表。 **/ public CommonResourcePaginatedRespDto listCommonResource(ListCommonResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-common-resource"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CommonResourcePaginatedRespDto.class); } /** * @summary 分页获取资源列表 * @description 根据筛选条件,分页获取资源详情列表。 **/ public ResourcePaginatedRespDto listResources(ListResourcesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-resources"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ResourcePaginatedRespDto.class); } /** * @summary 修改资源 * @description 修改资源,可以设置资源的描述、定义的操作类型、URL 标识等。 **/ public ResourceRespDto updateResource(UpdateResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ResourceRespDto.class); } /** * @summary 删除资源 * @description 通过资源唯一标志符以及所属权限分组,删除资源。 **/ public IsSuccessRespDto deleteResource(DeleteResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量删除资源 * @description 通过资源唯一标志符以及所属权限分组,批量删除资源 **/ public IsSuccessRespDto deleteResourcesBatch(DeleteResourcesBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-resources-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量删除资源 * @description 通过资源id批量删除资源 **/ public IsSuccessRespDto batchDeleteCommonResource(DeleteCommonResourcesBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-common-resources-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 关联/取消关联应用资源到租户 * @description 通过资源唯一标识以及权限分组,关联或取消关联资源到租户 **/ public IsSuccessRespDto associateTenantResource(AssociateTenantResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/associate-tenant-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 创建权限分组 * @description 创建权限分组,可以设置权限分组名称、Code 和描述信息。 **/ public NamespaceRespDto createNamespace(CreateNamespaceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-namespace"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, NamespaceRespDto.class); } /** * @summary 批量创建权限分组 * @description 批量创建权限分组,可以分别设置权限分组名称、Code 和描述信息。 **/ public IsSuccessRespDto createNamespacesBatch(CreateNamespacesBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-namespaces-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取权限分组详情 * @description 通过权限分组唯一标志符(Code),获取权限分组详情。 **/ public NamespaceRespDto getNamespace(GetNamespaceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-namespace"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, NamespaceRespDto.class); } /** * @summary 批量获取权限分组详情 * @description 分别通过权限分组唯一标志符(Code),批量获取权限分组详情。 **/ public NamespaceListRespDto getNamespacesBatch(GetNamespacesBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-namespaces-batch"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, NamespaceListRespDto.class); } /** * @summary 修改权限分组信息 * @description 修改权限分组信息,可以修改名称、描述信息以及新的唯一标志符(NewCode)。 **/ public UpdateNamespaceRespDto updateNamespace(UpdateNamespaceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-namespace"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UpdateNamespaceRespDto.class); } /** * @summary 删除权限分组信息 * @description 通过权限分组唯一标志符(Code),删除权限分组信息。 **/ public IsSuccessRespDto deleteNamespace(DeleteNamespaceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-namespace"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量删除权限分组 * @description 分别通过权限分组唯一标志符(Code),批量删除权限分组。 **/ public IsSuccessRespDto deleteNamespacesBatch(DeleteNamespacesBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-namespaces-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 分页获取权限分组列表 * @description 根据筛选条件,分页获取权限分组列表。 **/ public NamespaceListPaginatedRespDto listNamespaces(ListNamespacesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-namespaces"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, NamespaceListPaginatedRespDto.class); } /** * @summary 分页权限分组下所有的角色列表 * @description 根据筛选条件,分页获取权限分组下所有的角色列表。 **/ public NamespaceRolesListPaginatedRespDto listNamespaceRoles(ListNamespaceRolesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-namespace-roles"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, NamespaceRolesListPaginatedRespDto.class); } /** * @summary 授权资源 * @description 将一个/多个资源授权给用户、角色、分组、组织机构等主体,且可以分别指定不同的操作权限。 **/ public IsSuccessRespDto authorizeResources(AuthorizeResourcesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/authorize-resources"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取某个主体被授权的资源列表 * @description 根据筛选条件,获取某个主体被授权的资源列表。 **/ public AuthorizedResourcePaginatedRespDto getAuthorizedResources(GetAuthorizedResourcesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-authorized-resources"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, AuthorizedResourcePaginatedRespDto.class); } /** * @summary 判断用户是否对某个资源的某个操作有权限 * @description 判断用户是否对某个资源的某个操作有权限。 **/ public IsActionAllowedRespDtp isActionAllowed(IsActionAllowedDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/is-action-allowed"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsActionAllowedRespDtp.class); } /** * @summary 获取资源被授权的主体 * @description 获取资源被授权的主体 **/ public GetResourceAuthorizedTargetRespDto getResourceAuthorizedTargets(GetResourceAuthorizedTargetsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-resource-authorized-targets"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetResourceAuthorizedTargetRespDto.class); } /** * @summary 获取用户行为日志 * @description 可以选择请求 ID、客户端 IP、用户 ID、应用 ID、开始时间戳、请求是否成功、分页参数来获取用户行为日志 **/ public UserActionLogRespDto getUserActionLogs(GetUserActionLogsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-action-logs"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UserActionLogRespDto.class); } /** * @summary 获取管理员操作日志 * @description 可以选择请求 ID、客户端 IP、操作类型、资源类型、管理员用户 ID、请求是否成功、开始时间戳、结束时间戳、分页来获取管理员操作日志接口 **/ public AdminAuditLogRespDto getAdminAuditLogs(GetAdminAuditLogsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-admin-audit-logs"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, AdminAuditLogRespDto.class); } /** * @summary 获取邮件模版列表 * @description 获取邮件模版列表 **/ public GetEmailTemplatesRespDto getEmailTemplates() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-email-templates"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, GetEmailTemplatesRespDto.class); } /** * @summary 修改邮件模版 * @description 修改邮件模版 **/ public EmailTemplateSingleItemRespDto updateEmailTemplate(UpdateEmailTemplateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-email-template"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, EmailTemplateSingleItemRespDto.class); } /** * @summary 预览邮件模版 * @description 预览邮件模版 **/ public PreviewEmailTemplateRespDto previewEmailTemplate(PreviewEmailTemplateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/preview-email-template"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PreviewEmailTemplateRespDto.class); } /** * @summary 获取第三方邮件服务配置 * @description 获取第三方邮件服务配置 **/ public EmailProviderRespDto getEmailProvider() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-email-provider"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, EmailProviderRespDto.class); } /** * @summary 配置第三方邮件服务 * @description 配置第三方邮件服务 **/ public EmailProviderRespDto configEmailProvider(ConfigEmailProviderDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/config-email-provider"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, EmailProviderRespDto.class); } /** * @summary 获取应用详情 * @description 通过应用 ID,获取应用详情。 **/ public ApplicationSingleRespDto getApplication(GetApplicationDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-application"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ApplicationSingleRespDto.class); } /** * @summary 主体授权详情 * @description 主体授权详情 **/ public GetSubjectAuthRespDto detailAuthSubject(GetSubjectAuthDetailDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-subject-auth-detail"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetSubjectAuthRespDto.class); } /** * @summary 主体授权列表 * @description 主体授权列表 **/ public ListApplicationSubjectRespDto listAuthSubject(ListAuthSubjectDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-subject-auth"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ListApplicationSubjectRespDto.class); } /** * @summary 应用授权列表 * @description 应用授权列表 **/ public ListApplicationAuthPaginatedRespDto listAuthApplication(ListApplicationAuthDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-applications-auth"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ListApplicationAuthPaginatedRespDto.class); } /** * @summary 更新授权开关 * @description 更新授权开关 **/ public IsSuccessRespDto enabledAuth(UpdateAuthEnabledDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-auth-enabled"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量删除应用授权 * @description 批量删除应用授权 **/ /** * @summary 获取应用列表 * @description 获取应用列表 **/ public ApplicationPaginatedRespDto listApplications(ListApplicationsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-applications"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ApplicationPaginatedRespDto.class); } /** * @summary 获取应用简单信息 * @description 通过应用 ID,获取应用简单信息。 **/ public ApplicationSimpleInfoSingleRespDto getApplicationSimpleInfo(GetApplicationSimpleInfoDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-application-simple-info"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ApplicationSimpleInfoSingleRespDto.class); } /** * @summary 获取应用简单信息列表 * @description 获取应用简单信息列表 **/ public ApplicationSimpleInfoPaginatedRespDto listApplicationSimpleInfo(ListApplicationSimpleInfoDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-application-simple-info"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ApplicationSimpleInfoPaginatedRespDto.class); } /** * @summary 创建应用 * @description 创建应用 **/ public CreateApplicationRespDto createApplication(CreateApplicationDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-application"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateApplicationRespDto.class); } /** * @summary 删除应用 * @description 通过应用 ID,删除应用。 **/ public IsSuccessRespDto deleteApplication(DeleteApplicationDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-application"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取应用密钥 * @description 获取应用密钥 **/ public GetApplicationSecretRespDto getApplicationSecret(GetApplicationSecretDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-application-secret"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetApplicationSecretRespDto.class); } /** * @summary 刷新应用密钥 * @description 刷新应用密钥 **/ public RefreshApplicationSecretRespDto refreshApplicationSecret(RefreshApplicationSecretDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/refresh-application-secret"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, RefreshApplicationSecretRespDto.class); } /** * @summary 获取应用当前登录用户 * @description 获取应用当前处于登录状态的用户 **/ public UserPaginatedRespDto listApplicationActiveUsers(ListApplicationActiveUsersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-application-active-users"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UserPaginatedRespDto.class); } /** * @summary 获取应用默认访问授权策略 * @description 获取应用默认访问授权策略 **/ public GetApplicationPermissionStrategyRespDto getApplicationPermissionStrategy(GetApplicationPermissionStrategyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-application-permission-strategy"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetApplicationPermissionStrategyRespDto.class); } /** * @summary 更新应用默认访问授权策略 * @description 更新应用默认访问授权策略 **/ public IsSuccessRespDto updateApplicationPermissionStrategy(UpdateApplicationPermissionStrategyDataDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-application-permission-strategy"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 授权应用访问权限 * @description 给用户、分组、组织或角色授权应用访问权限,如果用户、分组、组织或角色不存在,则跳过,进行下一步授权,不返回报错 **/ public IsSuccessRespDto authorizeApplicationAccess(AuthorizeApplicationAccessDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/authorize-application-access"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 删除应用访问授权记录 * @description 取消给用户、分组、组织或角色的应用访问权限授权,如果传入数据不存在,则返回数据不报错处理。 **/ public IsSuccessRespDto revokeApplicationAccess(RevokeApplicationAccessDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/revoke-application-access"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 检测域名是否可用 * @description 检测域名是否可用于创建新应用或更新应用域名 **/ public CheckDomainAvailableSecretRespDto checkDomainAvailable(CheckDomainAvailable reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-domain-available"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CheckDomainAvailableSecretRespDto.class); } /** * @summary 获取租户应用列表 * @description 获取应用列表,可以指定 租户 ID 筛选。 **/ public TenantApplicationListPaginatedRespDto listTenantApplications(ListTenantApplicationsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-tenant-applications"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TenantApplicationListPaginatedRespDto.class); } /** * @summary 更新应用登录页配置 * @description 通过应用 ID 更新登录页配置。 **/ public IsSuccessRespDto updateLoginPageConfig(UpdateLoginConfigDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-login-page-config"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取用户池租户配置信息 * @description 根据用户池 ID 获取用户池多租户配置信息 **/ public UserPoolTenantConfigDtoRespDto userpollTenantConfig() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/userpool-tenant-config"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, UserPoolTenantConfigDtoRespDto.class); } /** * @summary 更新用户池租户配置信息 * @description 更新用户池多租户配置内登录信息 **/ public IsSuccessRespDto updateUserPoolTenantConfig(UpdateUserPoolTenantLoginConfigDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-userpool-tenant-config"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 更新租户控制台扫码登录状态 * @description 更新租户控制台扫码登录状态 **/ public IsSuccessRespDto updateTenantQrCodeState(UpdateTenantAppqrcodeState reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-userpool-tenant-appqrcode-state"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 设置用户池多租户身份源连接 * @description 设置用户池多租户身份源连接,支持同时设置多个身份源连接,支持设置连接和取消连接 **/ public IsSuccessRespDto changeUserpoolTenanExtIdpConnState(ChangeUserPoolTenantExtIdpConnDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/change-userpool-tenant-ext-idp-conn-state"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 修改应用多因素认证配置 * @description 传入 MFA 认证因素列表进行开启或关闭 **/ public MFASettingsRespDto updateApplicationMfaSettings(UpdateApplicationMfaSettingsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-application-mfa-settings"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, MFASettingsRespDto.class); } /** * @summary 获取应用下用户 MFA 触发数据 * @description 获取应用下用户 MFA 触发数据。 **/ public GetMapInfoRespDto getMfaTriggerData(GetMfaTriggerDataDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-mfa-trigger-data"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetMapInfoRespDto.class); } /** * @summary 创建 ASA 账号 * @description 在某一应用下创建 ASA 账号 **/ public AsaAccountSingleRespDto createAsaAccount(CreateAsaAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-asa-account"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, AsaAccountSingleRespDto.class); } /** * @summary 批量创建 ASA 账号 * @description 在某一应用下批量创建 ASA 账号 **/ public IsSuccessRespDto createAsaAccountBatch(CreateAsaAccountsBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-asa-accounts-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 更新 ASA 账号 * @description 更新某个 ASA 账号信息 **/ public AsaAccountSingleRespDto updateAsaAccount(UpdateAsaAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-asa-account"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, AsaAccountSingleRespDto.class); } /** * @summary 获取 ASA 账号列表 * @description 分页获取某一应用下的 ASA 账号列表 **/ public AsaAccountPaginatedRespDto listAsaAccount(ListAsaAccountsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-asa-accounts"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, AsaAccountPaginatedRespDto.class); } /** * @summary 获取 ASA 账号 * @description 根据 ASA 账号 ID 获取账号详细信息 **/ public AsaAccountSingleRespDto getAsaAccount(GetAsaAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-asa-account"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, AsaAccountSingleRespDto.class); } /** * @summary 批量获取 ASA 账号 * @description 根据 ASA 账号 ID 列表批量获取账号详细信息 **/ public AsaAccountListRespDto getAsaAccountBatch(GetAsaAccountBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-asa-accounts-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, AsaAccountListRespDto.class); } /** * @summary 删除 ASA 账号 * @description 通过 ASA 账号 ID 删除 ASA 账号 **/ public IsSuccessRespDto deleteAsaAccount(DeleteAsaAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-asa-account"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量删除 ASA 账号 * @description 通过 ASA 账号 ID 批量删除 ASA 账号 **/ public IsSuccessRespDto deleteAsaAccountBatch(DeleteAsaAccountBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-asa-accounts-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 分配 ASA 账号 * @description 分配 ASA 账号给用户、组织、分组或角色 **/ public IsSuccessRespDto assignAsaAccount(AssignAsaAccountsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/assign-asa-account"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 取消分配 ASA 账号 * @description 取消分配给用户、组织、分组或角色的 ASA 账号 **/ public IsSuccessRespDto unassignAsaAccount(AssignAsaAccountsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/unassign-asa-account"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取 ASA 账号分配的主体列表 * @description 根据 ASA 账号 ID 分页获取账号被分配的主体列表 **/ public GetAsaAccountAssignedTargetRespDto getAsaAccountAssignedTargets(GetAsaAccountAssignedTargetsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-asa-account-assigned-targets"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetAsaAccountAssignedTargetRespDto.class); } /** * @summary 获取主体被分配的 ASA 账号 * @description 根据主体类型和标识获取直接分配给主体的 ASA 账号 **/ public AsaAccountSingleNullableRespDto getAssignedAccount(GetAssignedAccountDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-assigned-account"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, AsaAccountSingleNullableRespDto.class); } /** * @summary 获取安全配置 * @description 无需传参获取安全配置 **/ public SecuritySettingsRespDto getSecuritySettings() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-security-settings"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, SecuritySettingsRespDto.class); } /** * @summary 修改安全配置 * @description 可选安全域、Authing Token 有效时间(秒)、验证码长度、验证码尝试次数、用户修改邮箱的安全策略、用户修改手机号的安全策略、Cookie 过期时间设置、是否禁止用户注册、频繁注册检测配置、验证码注册后是否要求用户设置密码、未验证的邮箱登录时是否禁止登录并发送认证邮件、用户自助解锁配置、Authing 登录页面是否开启登录账号选择、APP 扫码登录安全配置进行修改安全配置 **/ public SecuritySettingsRespDto updateSecuritySettings(UpdateSecuritySettingsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-security-settings"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, SecuritySettingsRespDto.class); } /** * @summary 获取全局多因素认证配置 * @description 无需传参获取全局多因素认证配置 **/ public MFASettingsRespDto getGlobalMfaSettings() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-global-mfa-settings"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, MFASettingsRespDto.class); } /** * @summary 修改全局多因素认证配置 * @description 传入 MFA 认证因素列表进行开启, **/ public MFASettingsRespDto updateGlobalMfaSettings(MFASettingsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-global-mfa-settings"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, MFASettingsRespDto.class); } /** * @summary 创建租户 **/ public CreateTenantRespDto createTenant(CreateTenantDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-tenant"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateTenantRespDto.class); } /** * @summary 更新租户数据 * @description 此接口用于更新租户基本信息。 **/ public IsSuccessRespDto updateTenant(UpdateTenantDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-tenant"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 删除租户 * @description 此接口用于删除租户。 **/ public IsSuccessRespDto deleteTenant(DeleteTenantDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-tenant"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取/搜索租户列表 * @description 此接口用于获取租户列表,支持模糊搜索。 **/ public TenantListPaginatedRespDto listTenants(ListTenantsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-tenants"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TenantListPaginatedRespDto.class); } /** * @summary 获取租户一点点的信息 * @description 根据租户 ID 获取租户一点点的详情 **/ public TenantSingleRespDto getTenantLittleInfo(GetTenantLittleInfoDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-tenant-little-info"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TenantSingleRespDto.class); } /** * @summary 获取租户详情 * @description 根据租户 ID 获取租户详情 **/ public TenantSingleRespDto getTenant(GetTenantDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-tenant"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TenantSingleRespDto.class); } /** * @summary 导入租户 * @description 此接口用于 Excel 导入租户。 **/ public ImportTenantRespDto importTenant(ImportTenantDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/import-tenant"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ImportTenantRespDto.class); } /** * @summary 导入租户历史 * @description 此接口用于 Excel 导入租户的历史查询。 **/ public ImportTenantHistoryRespDto importTenantHistory(ImportTenantHistoryDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/import-tenant-history"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ImportTenantHistoryRespDto.class); } /** * @summary 导入租户通知用户列表 * @description 此接口用于查询导入租户通知用户列表。 **/ public ImportTenantNotifyUserRespDto importTenantNotifyUser(ImportTenantNotifyUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/import-tenant-notify-user"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ImportTenantNotifyUserRespDto.class); } /** * @summary 导入租户通知邮箱用户 * @description 此接口用于批量发送邮件通知。 **/ public SendEmailBatchDataDto sendEmailBatch(SendManyTenantEmailDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/send-email-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, SendEmailBatchDataDto.class); } /** * @summary 导入租户短信通知用户 * @description 此接口用于批量发送短信通知。 **/ public SendSmsBatchRespDto sendSmsBatch(SendManyTenantSmsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/send-sms-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, SendSmsBatchRespDto.class); } /** * @summary 获取租户管理员列表 * @description 此接口用于获取租户成员列表,支持模糊搜索。 **/ public TenantUserListPaginatedRespDto listTenantAdmin(ListTenantAdminDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-tenant-admin"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, TenantUserListPaginatedRespDto.class); } /** * @summary 设置租户管理员 * @description 此接口用于根据用户 ID 或租户成员 ID 设置租户管理员。 **/ public CommonResponseDto setTenantAdmin(RemoveTenantUsersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/set-tenant-admin"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 取消设置租户管理员 * @description 此接口用于根据用户 ID 或租户成员 ID 取消设置租户管理员。 **/ public CommonResponseDto deleteTenantAdmin(GetTenantUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-tenant-admin"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 批量移除租户成员 * @description 此接口用于根据用户 ID 或租户成员 ID 批量移除租户成员。 **/ public CommonResponseDto deleteTenantUser(RemoveTenantUsersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-tenant-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 生成一个邀请租户成员的链接 * @description 此接口用于生成一个邀请租户成员的链接。appId 为用户注册成功后要访问的应用 ID **/ public InviteTenantUsersRespDto generateInviteTenantUserLink(GenerateInviteTenantUserLink reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/generate-invite-tenant-user-link"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, InviteTenantUsersRespDto.class); } /** * @summary 获取可访问的租户控制台列表 * @description 根据用户 ID 获取可访问的租户控制台列表 **/ public InviteTenantUserRecordListRespDto listInviteTennatUserRecords(ListInviteTenantUserRecordsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-invite-tenant-user-records"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, InviteTenantUserRecordListRespDto.class); } /** * @summary 获取多租户管理员用户列表 * @description 根据用户池 ID 获取某个用户池内拥有多租户管理权限的用户列表 **/ public MultipleTenantAdminPaginatedRespDto listMultipleTenantAdmin(ListMultipleTenantAdminsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-multiple-tenant-admins"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, MultipleTenantAdminPaginatedRespDto.class); } /** * @summary 创建多租户管理员用户 * @description 根据用户 ID 创建一个用户池内拥有多租户管理权限的用户 **/ public CommonResponseDto createMultipleTenantAdmin(CreateMultipleTenantAdminDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-multiple-tenant-admin"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取多租户管理员用户列表 * @description 根据用户池 ID 获取某个用户池内拥有多租户管理权限的用户列表 **/ public MultipleTenantAdminPaginatedRespDto getMultipleTenantAdmin(GetMultipleTenantAdminDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-multiple-tenant-admin"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, MultipleTenantAdminPaginatedRespDto.class); } /** * @summary 获取协作管理员用户列表 * @description 根据用户池 ID 获取某个用户池内拥有协作管理员能力的用户列表 **/ public TenantCooperatorPaginatedRespDto listTenantCooperators(ListTenantCooperatorsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-tenant-cooperators"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TenantCooperatorPaginatedRespDto.class); } /** * @summary 获取一个协调管理员 * @description 根据用户池 ID 获取某个协调管理员的列表 **/ public TenantCooperatorSingleRespDto getTenantCooperator(GetTenantCooperatorDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-tenant-cooperator"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TenantCooperatorSingleRespDto.class); } /** * @summary 获取一个协调管理员拥有的列表 * @description 根据用户池 ID 获取某个协调管理员的列表 **/ public TenantCooperatorSingleRespDto getTenantCooperatorMenu(GetTenantCooperatorMenuDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-tenant-cooperator-menu"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TenantCooperatorSingleRespDto.class); } /** * @summary 创建协调管理员 * @description 创建一个协调管理员 **/ public CommonResponseDto createTenantCooperator(CreateTenantCooperatorDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-tenant-cooperator"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取租户详情 * @description 根据租户 Code 获取租户详情 **/ public TenantSingleRespDto getTenantByCode(GetTenantByCodeDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-tenant-by-code"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TenantSingleRespDto.class); } /** * @summary 发送邀请租户用户邮件 * @description 向多个邮箱发送邀请成为租户用户的邮件 **/ public CommonResponseDto sendInviteTenantUserEmail(SendInviteTenantUserEmailDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/send-invite-tenant-user-email"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 添加租户成员 * @description 根据用户 ID 批量添加租户成员 **/ public CommonResponseDto addTenantUsers(AddTenantUsersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/add-tenant-users"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 批量移除租户成员 * @description 此接口用于根据用户 ID 或租户成员 ID 批量移除租户成员。 **/ public CommonResponseDto removeTenantUsers(RemoveTenantUsersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/remove-tenant-users"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 更新租户成员 * @description 此接口用于根据用户 ID 或租户成员 ID 更新租户成员。 **/ public CommonResponseDto updateTenantUser(UpdateTenantUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-tenant-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 创建租户成员 * @description 创建租户成员,邮箱、手机号、用户名必须包含其中一个,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份创建用户因此不需要进行手机号验证码检验等安全检测。 **/ public TenantUserDto createTenantUser(CreateTenantUserReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-tenant-user"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, TenantUserDto.class); } /** * @summary 获取/搜索租户成员列表 * @description * 此接口用于获取用户列表,支持模糊搜索,以及通过用户基础字段、用户自定义字段、用户所在部门、用户历史登录应用等维度筛选用户。 * * ### 模糊搜素示例 * * 模糊搜索默认会从 `phone`, `email`, `name`, `username`, `nickname` 五个字段对用户进行模糊搜索,你也可以通过设置 `options.fuzzySearchOn` * 决定模糊匹配的字段范围: * * ```json * { * "keywords": "北京", * "options": { * "fuzzySearchOn": [ * "address" * ] * } * } * ``` * * ### 高级搜索示例 * * 你可以通过 `advancedFilter` 进行高级搜索,高级搜索支持通过用户的基础信息、自定义数据、所在部门、用户来源、登录应用、外部身份源信息等维度对用户进行筛选。 * **且这些筛选条件可以任意组合。** * * #### 筛选邮箱中包含 `@example.com` 的用户 * * 用户邮箱(`email`)为字符串类型,可以进行模糊搜索: * * ```json * { * "advancedFilter": [ * { * "field": "email", * "operator": "CONTAINS", * "value": "@example.com" * } * ] * } * ``` * * * #### 根据用户登录次数筛选 * * 筛选登录次数大于 10 的用户: * * ```json * { * "advancedFilter": [ * { * "field": "loginsCount", * "operator": "GREATER", * "value": 10 * } * ] * } * ``` * * 筛选登录次数在 10 - 100 次的用户: * * ```json * { * "advancedFilter": [ * { * "field": "loginsCount", * "operator": "BETWEEN", * "value": [10, 100] * } * ] * } * ``` * * #### 根据用户上次登录时间进行筛选 * * 筛选最近 7 天内登录过的用户: * * ```json * { * "advancedFilter": [ * { * "field": "lastLoginTime", * "operator": "GREATER", * "value": new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) * } * ] * } * ``` * * 筛选在某一段时间内登录过的用户: * * ```json * { * "advancedFilter": [ * { * "field": "lastLoginTime", * "operator": "BETWEEN", * "value": [ * Date.now() - 14 * 24 * 60 * 60 * 1000, * Date.now() - 7 * 24 * 60 * 60 * 1000 * ] * } * ] * } * ``` * * #### 根据用户曾经登录过的应用筛选 * * 筛选出曾经登录过应用 `appId1` 或者 `appId2` 的用户: * * ```json * { * "advancedFilter": [ * { * "field": "loggedInApps", * "operator": "IN", * "value": [ * "appId1", * "appId2" * ] * } * ] * } * ``` * * #### 根据用户所在部门进行筛选 * * ```json * { * "advancedFilter": [ * { * "field": "department", * "operator": "IN", * "value": [ * { * "organizationCode": "steamory", * "departmentId": "root", * "departmentIdType": "department_id", * "includeChildrenDepartments": true * } * ] * } * ] * } * ``` * * **/ public TenantUserListPaginatedRespDto listTenantUsers(ListTenantUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-tenant-users"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, TenantUserListPaginatedRespDto.class); } /** * @summary 获取单个租户成员 * @description 根据用户 ID 或租户成员 ID 获取租户成员信息 **/ public TenantUserSingleRespDto getTenantUser(GetTenantUserDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-tenant-user"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, TenantUserSingleRespDto.class); } /** * @summary 租户部门下添加成员 * @description 通过部门 ID、组织 code,添加部门下成员。 **/ public IsSuccessRespDto addTenantDepartmentMembers(AddTenantDepartmentMembersReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/add-tenant-department-members"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 租户部门下删除成员 * @description 通过部门 ID、组织 code,删除部门下成员。 **/ public IsSuccessRespDto removeTenantDepartmentMembers(RemoveTenantDepartmentMembersReqDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/remove-tenant-department-members"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 创建权限空间 * @description 创建权限空间,可以设置权限空间名称、Code 和描述信息。 **/ public CreatePermissionNamespaceResponseDto createPermissionNamespace(CreatePermissionNamespaceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-permission-namespace"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreatePermissionNamespaceResponseDto.class); } /** * @summary 批量创建权限空间 * @description 批量创建权限空间,可以分别设置权限空间名称、Code 和描述信息。 **/ public IsSuccessRespDto createPermissionNamespacesBatch(CreatePermissionNamespacesBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-permission-namespaces-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取权限空间详情 * @description 通过权限空间唯一标志符(Code),获取权限空间详情。 **/ public GetPermissionNamespaceResponseDto getPermissionNamespace(GetPermissionNamespaceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-permission-namespace"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetPermissionNamespaceResponseDto.class); } /** * @summary 批量获取权限空间详情列表 * @description 分别通过权限空间唯一标志符(Code),获取权限空间详情。 **/ public GetPermissionNamespaceListResponseDto getPermissionNamespacesBatch(GetPermissionNamespacesBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-permission-namespaces-batch"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetPermissionNamespaceListResponseDto.class); } /** * @summary 分页获取权限空间列表 * @description 分页获取权限空间列表。 **/ public PermissionNamespaceListPaginatedRespDto listPermissionNamespaces(ListPermissionNamespacesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-permission-namespaces"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PermissionNamespaceListPaginatedRespDto.class); } /** * @summary 修改权限空间 * @description 修改权限空间,可以修改权限空间名称、权限空间描述信息以及权限空间新的唯一标志符(Code)。 **/ public UpdatePermissionNamespaceResponseDto updatePermissionNamespace(UpdatePermissionNamespaceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-permission-namespace"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UpdatePermissionNamespaceResponseDto.class); } /** * @summary 删除权限空间 * @description 通过权限空间唯一标志符(Code),删除权限空间信息。 **/ public IsSuccessRespDto deletePermissionNamespace(DeletePermissionNamespaceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-permission-namespace"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量删除权限空间 * @description 分别通过权限空间唯一标志符(Code),批量删除权限空间信息。 **/ public IsSuccessRespDto deletePermissionNamespacesBatch(DeletePermissionNamespacesBatchDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-permission-namespaces-batch"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 校验权限空间 Code 或者名称是否可用 * @description 通过用户池 ID 和权限空间 Code,或者用户池 ID 和权限空间名称查询是否可用。 **/ public PermissionNamespaceCheckExistsRespDto checkPermissionNamespaceExists(CheckPermissionNamespaceExistsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-permission-namespace-exists"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PermissionNamespaceCheckExistsRespDto.class); } /** * @summary 分页查询权限空间下所有的角色列表 * @description 分页查询权限空间下所有的角色列表,分页获取权限空间下所有的角色列表。 **/ public PermissionNamespaceRolesListPaginatedRespDto listPermissionNamespaceRoles(ListPermissionNamespaceRolesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-permission-namespace-roles"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PermissionNamespaceRolesListPaginatedRespDto.class); } /** * @summary 创建数据资源(推荐、重点) * @description * ## 描述 * 该接口用于创建数据资源,当你存在需要被设置权限的数据,根据它们的数据类型,创建对应类型的数据资源,目前我们支持:字符串、数组、树三种类型。 * ## 注意 * 请求体中的 `struct` 字段需要根据不同的资源类型传入不同的数据结构,具体请参考下面的示例 * ## 请求示例 * ### 创建字符串类型数据资源示例 * 当你的数据仅用一个字符串就可以表示时,可以使用此类型,例如:一个 API、一个用户 ID 等。 * 以下是创建一个表示 '/resource/create' API 的数据资源示例: * ```json * { * "namespaceCode": "examplePermissionNamespace", * "resourceName": "createResource API", * "description": "这是 createResource API", * "resourceCode": "createResourceAPI", * "type": "STRING", * "struct": "/resource/create", * "actions": ["access"] * } * ``` * * ### 创建数组类型数据资源示例 * 当你的数据是一组同类型的数据时,可以使用此类型,例如:一组文档链接、一组门禁卡号等。 * 以下是创建一个表示一组门禁卡号的数据资源示例: * ```json * { * "namespaceCode": "examplePermissionNamespace", * "resourceName": "一组门禁卡号", * "description": "这是一组门禁卡号", * "resourceCode": "accessCardNumber", * "type": "ARRAY", * "struct": ["accessCardNumber1", "accessCardNumber2", "accessCardNumber3"], * "actions": ["get", "update"] * } * ``` * * ### 创建树类型数据资源示例 * 当你的数据是具备层级关系时,可以使用此类型,例如:组织架构、文件夹结构等。 * 以下是创建一个表示公司组织架构的数据资源示例: * ```json * { * "namespaceCode": "examplePermissionNamespace", * "resourceName": "Authing", * "description": "这是 Authing 的组织架构", * "resourceCode": "authing", * "type": "TREE", * "struct": [ * { * "name": "产品", * "code": "product", * "value": "product", * "children": [ * { * "name": "产品经理", * "code": "productManager", * "value": "pm" * }, * { * "name": "设计", * "code": "design", * "value": "ui" * } * ] * }, * { * "name": "研发", * "code": "researchAndDevelopment", * "value": "rd" * } * ], * "actions": ["get", "update", "delete"] * } * ``` * **/ public CreateDataResourceResponseDto createDataResource(CreateDataResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-data-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateDataResourceResponseDto.class); } /** * @summary 创建字符串数据资源 * @description 当你仅需要创建字符串类型数据资源时,可以使用此 API,我们固定了数据资源类型,你无需在传入 `type` 字符段,注意:`struct` 字段只能够传入字符串类型数据。 **/ public CreateStringDataResourceResponseDto createDataResourceByString(CreateStringDataResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-string-data-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateStringDataResourceResponseDto.class); } /** * @summary 创建数组数据资源 * @description 当你仅需要创建数组类型数据资源时,可以使用此 API,我们固定了数据资源类型,你无需在传入 `type` 字符段,注意:`struct` 字段只能够传入数组类型数据。 **/ public CreateArrayDataResourceResponseDto createDataResourceByArray(CreateArrayDataResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-array-data-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateArrayDataResourceResponseDto.class); } /** * @summary 创建树数据资源 * @description 当你仅需要创建树类型数据资源时,可以使用此 API,我们固定了数据资源类型,你无需在传入 `type` 字符段,注意:`struct` 要按照树类型数据资源结构进行传入,请参考示例。 **/ public CreateTreeDataResourceResponseDto createDataResourceByTree(CreateTreeDataResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-tree-data-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateTreeDataResourceResponseDto.class); } /** * @summary 获取数据资源列表 * @description 获取数据资源列表,可通过数据资源名称、数据资源 Code 和数据资源所属权限空间 Code 列表进行指定筛选。 **/ public ListDataResourcesPaginatedRespDto listDataResources(ListDataResourcesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-data-resources"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ListDataResourcesPaginatedRespDto.class); } /** * @summary 获取数据资源详情 * @description 获取数据资源,通过数据资源 ID 查询对应的数据资源信息,包含数据资源名称、数据资源 Code、数据资源类型(TREE、STRING、ARRAY)、数据资源所属权限空间 ID、数据资源所属权限空间 Code 以及数据资源操作列表等基本信息。 **/ public GetDataResourceResponseDto getDataResource(GetDataResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-data-resource"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetDataResourceResponseDto.class); } /** * @summary 修改数据资源 * @description 修改数据资源,根据权限空间 Code 和数据资源 Code 查询原始信息,只允许修改数据资源名称、描述和数据资源节点。 **/ public UpdateDataResourceResponseDto updateDataResource(UpdateDataResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-data-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UpdateDataResourceResponseDto.class); } /** * @summary 删除数据资源 * @description 删除数据资源,根据数据资源 ID 删除对应的数据资源信息。 **/ public CommonResponseDto deleteDataResource(DeleteDataResourceDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-data-resource"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 检查数据资源 Code 或者名称是否可用 * @description 检查数据资源名称或者 Code 在权限空间内是否有效,通过数据资源名称或者数据资源 Code 以及所属权限空间 Code,判断在指定的权限空间内是否可用。 * * ### 数据资源 Code 有效示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "resourceCode": "test" * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 0, * "data": { * "isValid": "true" * } * } * ``` * * ### 数据资源名称有效示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "resourceName": "test" * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 0, * "data": { * "isValid": "true" * } * } * ``` * * ### 数据资源 Code 无效示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "resourceCode": "test" * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 0, * "requestId": "934108e5-9fbf-4d24-8da1-c330328abd6c", * "data": { * "isValid": "false", * "message": "data resource code already exist" * } * } * ``` * **/ public CheckParamsDataResourceResponseDto checkDataResourceExists(CheckDataResourceExistsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-data-resource-exists"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CheckParamsDataResourceResponseDto.class); } /** * @summary 创建数据资源扩展字段 */ public IsSuccessRespDto createDnef(CreateDenfDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-dnef"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 批量创建数据资源扩展字段 */ public IsSuccessRespDto batchCreateDnef(BatchCreateDenfDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/batch-create-dnef"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 删除数据资源扩展字段 */ public IsSuccessRespDto deleteDnef(DeleteDenfDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-dnef"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 修改数据资源扩展字段 */ public IsSuccessRespDto updateDnef(UpdateDenfDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-dnef"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取数据资源扩展字段列表 */ public GetDenfListResponseDto getDnefList(GetDenfListDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-dnef"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetDenfListResponseDto.class); } /** * @summary 创建数据策略(重点) * @description * ## 描述 * 该接口用于创建数据策略,通过数据策略你可以将一组数据资源及其指定的操作进行绑定到一起,共同授权给主体。 * ## 注意 * 为了方便使用,`permissions` 字段我们基于路径的方式提供了快捷的写法,如: * - 数组、字符串资源:权限空间 code/数据资源 code/数据资源某一 action(如果表示所有操作,则使用`*`替代action) * - 树类型资源:权限空间 code/数据资源 code/node code 1/node code 1_1/.../数据资源某一 action * * ## 请求示例 * 假设我们要对一名研发人员进行授权,首先创建 3 个数据资源如下: * ```json * { * "namespaceCode": "examplePermissionNamespace", * "resourceName": "服务器", * "resourceCode": "server_2023", * "type": "STRING", * "struct": "server_2023", * "actions": ["read", "write"] * } * ``` * ```json * { * "namespaceCode": "examplePermissionNamespace", * "resourceName": "研发知识库", * "description": "", * "resourceCode": "rd_document", * "type": "STRING", * "struct": "https://www.authing.com/rd_document", * "actions": ["read", "write", "share"] * } * ``` * ```json * { * "namespaceCode": "examplePermissionNamespace", * "resourceName": "研发内部平台菜单", * "description": "这是研发使用的内部平台菜单", * "resourceCode": "rd_internal_platform", * "type": "TREE", * "struct": [ * { * "name": "部署", * "code": "deploy", * "children": [ * { * "name": "生产环境", * "code": "prod" * }, * { * "name": "测试环境", * "code": "test" * } * ] * }, * { * "name": "数据库", * "code": "db" * "children": [ * { * "name": "查询", * "code": "query" * }, * { * "name": "导出", * "code": "export" * } * ] * } * ], * "actions": ["access", "execute"] * } * ``` * 我们分配一台服务器:server_2023 给他使用,他可以在上面进行任意操作,同时他可以阅读、编辑研发知识库,最后他可以在研发内部平台中进行部署测试环境,但是不能够导出数据库数据。 * ```json * { * "policyName": "研发人员策略", * "description": "这是一个示例数据策略", * "statementList": [ * { * "effect": "ALLOW", * "permissions": [ * "examplePermissionNamespaceCode/server_2023*", * "examplePermissionNamespaceCode/rd_document/read", * "examplePermissionNamespaceCode/rd_document/write", * "examplePermissionNamespaceCode/rd_internal_platform/deploy/test/execute" * ] * }, * { * "effect": "DENY", * "permissions": [ * "examplePermissionNamespaceCode/rd_internal_platform/db/export/execute" * ] * } * ] * } * ``` * **/ public CreateDataPolicyResponseDto createDataPolicy(CreateDataPolicyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-data-policy"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateDataPolicyResponseDto.class); } /** * @summary 获取数据策略列表 * @description 分页查询数据策略列表,也可通过关键字搜索数据策略名称或者数据策略 Code 进行模糊查找。 **/ public ListDataPoliciesPaginatedRespDto listDataPolices(ListDataPoliciesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-data-policies"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ListDataPoliciesPaginatedRespDto.class); } /** * @summary 获取数据策略简略信息列表 * @description 分页获取数据策略简略信息列表,通过关键字搜索数据策略名称或者数据策略 Code 进行模糊查找出数据策略 ID、数据策略名称和数据策略描述信息。 **/ public ListSimpleDataPoliciesPaginatedRespDto listSimpleDataPolices(ListSimpleDataPoliciesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-simple-data-policies"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ListSimpleDataPoliciesPaginatedRespDto.class); } /** * @summary 获取数据策略详情 * @description 获取数据策略详情,通过数据策略 ID 获取对应数据策略信息,包含数据策略 ID、数据策略名称、数据策略描述、数据策略下所有的数据权限列表等信息。 **/ public GetDataPolicyResponseDto getDataPolicy(GetDataPolicyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-data-policy"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetDataPolicyResponseDto.class); } /** * @summary 修改数据策略 * @description 修改数据策略,通过数据策略名称、数据策略描述和相关的数据资源等字段修改数据策略信息。 **/ public UpdateDataPolicyResponseDto updateDataPolicy(UpdateDataPolicyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-data-policy"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UpdateDataPolicyResponseDto.class); } /** * @summary 删除数据策略 * @description 删除数据策略,通过数据策略 ID 删除对应的策略,同时也删除数据策略和对应的数据资源等关系数据。 **/ public CommonResponseDto deleteDataPolicy(DeleteDataPolicyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-data-policy"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 检查数据策略名称是否可用 * @description 通过数据策略名称查询用户池内是否有效。 **/ public CheckParamsDataPolicyResponseDto checkDataPolicyExists(CheckDataPolicyExistsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-data-policy-exists"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CheckParamsDataPolicyResponseDto.class); } /** * @summary 获取数据策略授权的主体列表 * @description 获取数据策略授权的主体列表,通过授权主体类型、数据策略 ID 和数据资源 ID 查找授权主体列表。 **/ public ListDataPolicySubjectPaginatedRespDto listDataPolicyTargets(ListDataPolicyTargetsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-data-policy-targets"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ListDataPolicySubjectPaginatedRespDto.class); } /** * @summary 授权数据策略 * @description 数据策略创建主体授权,通过授权主体和数据策略进行相互授权。 **/ public CommonResponseDto authorizeDataPolicies(CreateAuthorizeDataPolicyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/authorize-data-policies"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 删除数据策略授权 * @description 删除数据策略授权,通过授权主体 ID、授权主体类型和数据策略 ID 进行删除。 **/ public CommonResponseDto revokeDataPolicy(DeleteAuthorizeDataPolicyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/revoke-data-policy"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取用户权限列表 * @description * ## 描述 * 该接口用于查询某些用户在某些权限空间的数据资源的权限数据。 * 我们的鉴权接口针对不同的鉴权场景有多种,区别在于在所处的场景下能够传递的参数列表以及不同形式的出参,**当你需要查询某些用户的所有权限时**可以使用此接口, * ## 注意 * 接口提供了两个数组类型的入参`userIds`和`namespaceCodes`来支持批量查询(注意:namespaceCodes 是可选的)。 * ## 场景举例 * 假如你的业务场景是用户登录后能看到他所有可以访问或者进行其他操作的文档、人员信息、设备信息等资源,那么你可以在用户登录后调用此接口查询用户的所有权限。 * ## 请求示例 * ### 查询单个用户权限列表示例 * 注意:在此接口的返回参数中,树类型的数据资源权限返回是按照**路径**的方式返回的 * - 入参 * * ```json * { * "userIds": [ * "6301ceaxxxxxxxxxxx27478" * ] * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data": { * "userPermissionList": [ * { * "userId": "6301ceaxxxxxxxxxxx27478", * "namespaceCode": "examplePermissionNamespace", * "resourceList": [ * { * "resourceCode": "strCode", * "resourceType": "STRING", * "strAuthorize": { * "value": "示例字符串资源", * "actions": [ * "read", * "post", * "get", * "write" * ] * } * }, * { * "resourceCode": "arrayCode", * "resourceType": "ARRAY", * "arrAuthorize": { * "values": [ * "示例数据资源1", * "示例数据资源2" * ], * "actions": [ * "read", * "post", * "get", * "write" * ] * } * }, * { * "resourceCode": "treeCode", * "resourceType": "TREE", * "treeAuthorize": { * "authList": [ * { * "nodePath": "/treeChildrenCode/treeChildrenCode1", * "nodeActions": [ * "read", * "get" * ], * "nodeName": "treeChildrenName1", * "nodeValue": "treeChildrenValue1" * }, * { * "nodePath": "/treeChildrenCode/treeChildrenCode2", * "nodeActions": [ * "read", * "get" * ], * "nodeName": "treeChildrenName2", * "nodeValue": "treeChildrenValue2" * }, * { * "nodePath": "/treeChildrenCode/treeChildrenCode3", * "nodeActions": [ * "read" * ], * "nodeName": "treeChildrenName3", * "nodeValue": "treeChildrenValue3" * } * ] * } * } * ] * } * ] * } * } * ``` * * ### 查询多个用户权限列表示例 * * - 入参 * * ```json * { * "userIds": [ * "6301ceaxxxxxxxxxxx27478", * "6121ceaxxxxxxxxxxx27312" * ] * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data": { * "userPermissionList": [ * { * "userId": "6301ceaxxxxxxxxxxx27478", * "namespaceCode": "examplePermissionNamespace1", * "resourceList": [ * { * "resourceCode": "strCode", * "resourceType": "STRING", * "strAuthorize": { * "value": "示例字符串资源", * "actions": [ * "read", * "post", * "get", * "write" * ] * } * } * ] * }, * { * "userId": "6121ceaxxxxxxxxxxx27312", * "namespaceCode": "examplePermissionNamespace2", * "resourceList": [ * { * "resourceCode": "arrayCode", * "resourceType": "ARRAY", * "arrAuthorize": { * "values": [ * "示例数组资源1", * "示例数组资源2" * ], * "actions": [ * "read", * "post", * "get", * "write" * ] * } * } * ] * } * ] * } * } * ``` * * ### 查询多个用户在多个权限空间下权限列表示例 * * - 入参 * * ```json * { * "userIds": [ * "6301ceaxxxxxxxxxxx27478", * "6121ceaxxxxxxxxxxx27312" * ], * "namespaceCodes": [ * "examplePermissionNamespace1", * "examplePermissionNamespace2" * ] * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data": { * "userPermissionList": [ * { * "userId": "6301ceaxxxxxxxxxxx27478", * "namespaceCode": "examplePermissionNamespace1", * "resourceList": [ * { * "resourceCode": "strCode1", * "resourceType": "STRING", * "strAuthorize": { * "value": "示例字符串资源", * "actions": [ * "read", * "post", * "get", * "write" * ] * } * } * ] * }, * { * "userId": "6121ceaxxxxxxxxxxx27312", * "namespaceCode": "examplePermissionNamespace2", * "resourceList": [ * { * "resourceCode": "arrayCode", * "resourceType": "ARRAY", * "arrAuthorize": { * "values": [ * "示例数组资源1", * "示例数组资源2" * ], * "actions": [ * "read", * "post", * "get", * "write" * ] * } * } * ] * } * ] * } * } * ``` * **/ public GetUserPermissionListRespDto getUserPermissionList(GetUserPermissionListDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-permission-list"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetUserPermissionListRespDto.class); } /** * @summary 判断用户权限(重点) * @description * ## 描述 * 当你需要判断用户是否拥有某些资源的指定权限时可以使用此接口 * ## 注意 * - 该接口通过传递资源 code 定位对应的数据资源(如果是树类型,则需要传递节点的完整 code 路径)。 * - 如果你在配置数据策略时配置了**环境属性**的条件判断,那么需要设置参数`judgeConditionEnabled`为`true`(默认为 false),并且通过参数`authEnvParams`传递请求时所处的环境信息(如 IP、设备类型、系统类型等),否则条件判断会不生效,导致数据策略不生效。 * * ## 场景举例 * 用户在删除某条数据时,需要判断他是否拥有此资源的删除权限,则可以使用此接口。 * * ## 请求示例 * ### 判断用户对字符串和数组资源权限示例(无条件判断) * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "userId": "63721xxxxxxxxxxxxdde14a3", * "action": "get", * "resources":["strResourceCode1", "arrayResourceCode1"] * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data": { * "checkResultList": [ * { * "namespaceCode": "examplePermissionNamespace", * "resource": "strResourceCode1", * "action": "get", * "enabled": true * }, * { * "namespaceCode": "examplePermissionNamespace", * "resource": "arrayResourceCode1", * "action": "get", * "enabled": true * } * ] * } * } * ``` * * ### 判断用户对字符串和数组资源权限示例(开启条件判断) * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "userId": "63721xxxxxxxxxxxxdde14a3", * "action": "get", * "resources": ["strResourceCode1", "arrayResourceCode1"], * "judgeConditionEnabled": true, * "authEnvParams":{ * "ip":"110.96.0.0", * "city":"北京", * "province":"北京", * "country":"中国", * "deviceType":"PC", * "systemType":"ios", * "browserType":"IE", * "requestDate":"2022-12-26 17:40:00" * } * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data": { * "checkResultList": [ * { * "namespaceCode": "examplePermissionNamespace", * "resource": "strResourceCode1", * "action": "get", * "enabled": false * }, * { * "namespaceCode": "examplePermissionNamespace", * "resource": "arrayResourceCode1", * "action": "get", * "enabled": false * } * ] * } * } * ``` * * ### 判断用户对树资源权限示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "userId": "63721xxxxxxxxxxxxdde14a3", * "action": "get", * "resources":["treeResourceCode1/StructCode1/resourceStructChildrenCode1", "treeResourceCode2/StructCode1/resourceStructChildrenCode1"] * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "checkResultList": [{ * "namespaceCode": "examplePermissionNamespace", * "action": "get", * "resource": "treeResourceCode1/StructCode1/resourceStructChildrenCode1", * "enabled": true * },{ * "namespaceCode": "examplePermissionNamespace", * "action": "get", * "resource": "treeResourceCode2/StructCode1/resourceStructChildrenCode1", * "enabled": true * }] * } * } * ``` * **/ public CheckPermissionRespDto checkPermission(CheckPermissionDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-permission"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CheckPermissionRespDto.class); } /** * @summary 判断外部用户权限 * @description * ## 描述 * 当你的用户是外部用户,需要判断其是否拥有某资源的某一权限时,可以使用此接口,通过`externalId`来传递用户的 ID * **/ public CheckExternalUserPermissionRespDto checkExternalUserPermission(CheckExternalUserPermissionDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-external-user-permission"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CheckExternalUserPermissionRespDto.class); } /** * @summary 获取用户拥有某些资源的权限列表(推荐) * @description * ## 描述 * 当你需要查询某一用户拥有指定的资源列表的权限时,可以使用此接口。 * ## 注意 * 该接口需要你传递指定的资源 code(如果是树类型资源则需要传递节点的完整 code 路径),此接口性能更佳,推荐使用。 * ## 请求示例 * ### 获取用户字符串和数组资源权限示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "userId": "63721xxxxxxxxxxxxdde14a3", * "resources":["strResourceCode1", "arrayResourceCode1"] * } * ``` * * - 出参 * * ```json * { * * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "permissionList": [{ * "namespaceCode": "examplePermissionNamespace", * "actions": ["read","get"], * "resource": "strResourceCode1" * },{ * "namespaceCode": "examplePermissionNamespace", * "actions": ["read","update","delete"], * "resource": "arrayResourceCode1" * }] * } * } * ``` * * ### 获取用户树资源权限示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "userId": "63721xxxxxxxxxxxxdde14a3", * "resources":["treeResourceCode1/StructCode1/resourceStructChildrenCode1", "treeResourceCode2/StructCode1/resourceStructChildrenCode1"] * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "permissionList": [{ * "namespaceCode": "examplePermissionNamespace", * "actions": ["read", "update", "delete"], * "resource": "treeResourceCode1/StructCode1/resourceStructChildrenCode1" * },{ * "namespaceCode": "examplePermissionNamespace", * "actions": ["read", "get", "delete"], * "resource": "treeResourceCode2/StructCode1/resourceStructChildrenCode1" * }] * } * } * ``` * **/ public GetUserResourcePermissionListRespDto getUserResourcePermissionList(GetUserResourcePermissionListDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-resource-permission-list"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetUserResourcePermissionListRespDto.class); } /** * @summary 获取拥有某些资源权限的用户列表 * @description * ## 描述 * 当你需要获取拥有指定资源的权限的用户时,可以使用此接口。 * ## 场景举例 * 假如你的业务场景是:想看看当前文档能够编辑的用户列表,那么你可以使用此接口。 * ## 请求示例 * ### 获取字符串和数组资源被授权的用户列表示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "actions": ["get", "update", "read"], * "resources":["strResourceCode1", "arrayResourceCode1"] * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "authUserList": [{ * "resource": "strResourceCode1", * "actionAuthList": [{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "get" * },{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "update" * },{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "read" * }] * },{ * "resource": "arrayResourceCode1", * "actionAuthList": [{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "get" * },{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "update" * },{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "read" * }] * }] * } * } * ``` * * ### 获取树资源被授权的用户列表示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "actions": ["get", "update", "delete"], * "resources":["treeResourceCode1/StructCode1/resourceStructChildrenCode1", "treeResourceCode2/StructCode1/resourceStructChildrenCode1"] * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "authUserList": [{ * "resource": "treeResourceCode1/StructCode1/resourceStructChildrenCode1", * "actionAuthList": [{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "get" * },{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "update" * },{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "delete" * }] * },{ * "resource": "treeResourceCode2/StructCode1/resourceStructChildrenCode1", * "actionAuthList": [{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "get" * },{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "update" * },{ * "userIds": ["63721xxxxxxxxxxxxdde14a3"], * "action": "delete" * }] * }] * } * } * ``` * **/ public ListResourceTargetsRespDto listResourceTargets(ListResourceTargetsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-resource-targets"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ListResourceTargetsRespDto.class); } /** * @summary 获取用户拥有指定资源的权限及资源结构信息 * @description * ## 描述 * 当你需要获取用户拥有某一资源的权限并且需要这个资源的结构信息(树类型资源返回树结构,数组类型资源返回数组、字符串类型返回字符串)则可以使用此接口。 * ## 注意 * 由于其他接口对树类型资源的返回参数格式是按照路径的方式返回的,所以我们提供此此接口,按照完整的树结构形式返回。 * ## 请求示例 * ### 获取用户授权字符串数据资源示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "userId": "63721xxxxxxxxxxxxdde14a3", * "resourceCode": "exampleStrResourceCode" * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "namespaceCode": "exampleNamespaceCode", * "resourceCode": "exampleStrResourceCode", * "resourceType": "STRING", * "strResourceAuthAction":{ * "value": "strTestValue", * "actions": ["get","delete"] * } * } * } * ``` * * * ### 获取用户授权数据数组资源示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "userId": "63721xxxxxxxxxxxxdde14a3", * "resourceCode": "exampleArrResourceCode" * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "namespaceCode": "exampleNamespaceCode", * "resourceCode": "exampleArrResourceCode", * "resourceType": "ARRAY", * "arrResourceAuthAction":{ * "values": ["arrTestValue1","arrTestValue2","arrTestValue3"], * "actions": ["get","delete"] * } * } * } * ``` * * * ### 获取用户授权树数据资源示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "userId": "63721xxxxxxxxxxxxdde14a3", * "resourceCode": "exampleTreeResourceCode" * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "namespaceCode": "exampleNamespaceCode", * "resourceCode": "exampleArrResourceCode", * "resourceType": "TREE", * "treeResourceAuthAction":{ * "nodeAuthActionList":[{ * "code": "tree11", * "name": "tree11", * "value": "test11Value", * "actions": ["get","delete"], * "children": [{ * "code": "tree111", * "name": "tree111", * "value": "test111Value", * "actions": ["update","read"], * }] * },{ * "code": "tree22", * "name": "tree22", * "value": "test22Value", * "actions": ["get","delete"] * }] * } * } * } * ``` * **/ public GetUserResourceStructRespDto getUserResourceStruct(GetUserResourceStructDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-user-resource-struct"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetUserResourceStructRespDto.class); } /** * @summary 获取外部用户拥有指定资源的权限及资源结构信息 * @description * ## 描述 * 当你需要获取外部用户(通过参数`externalId`参数传递外部用户 ID)拥有某一资源的权限并且需要这个资源的结构信息(树类型资源返回树结构,数组类型资源返回数组、字符串类型返回字符串)则可以使用此接口。 * ## 请求示例 * ### 获取用户授权字符串数据资源示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "externalId": "63721xxxxxxxxxxxxdde14a3", * "resourceCode": "exampleStrResourceCode" * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "namespaceCode": "exampleNamespaceCode", * "resourceCode": "exampleStrResourceCode", * "resourceType": "STRING", * "strResourceAuthAction":{ * "value": "strTestValue", * "actions": ["get","delete"] * } * } * } * ``` * * * ### 获取用户授权数据数组资源示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "externalId": "63721xxxxxxxxxxxxdde14a3", * "resourceCode": "exampleArrResourceCode" * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "namespaceCode": "exampleNamespaceCode", * "resourceCode": "exampleArrResourceCode", * "resourceType": "ARRAY", * "arrResourceAuthAction":{ * "values": ["arrTestValue1","arrTestValue2","arrTestValue3"], * "actions": ["get","delete"] * } * } * } * ``` * * * ### 获取用户授权树数据资源示例 * * - 入参 * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "externalId": "63721xxxxxxxxxxxxdde14a3", * "resourceCode": "exampleTreeResourceCode" * } * ``` * * - 出参 * * ```json * { * "statusCode": 200, * "message": "操作成功", * "apiCode": 20001, * "data":{ * "namespaceCode": "exampleNamespaceCode", * "resourceCode": "exampleArrResourceCode", * "resourceType": "TREE", * "treeResourceAuthAction":{ * "nodeAuthActionList":[{ * "code": "tree11", * "name": "tree11", * "value": "test11Value", * "actions": ["get","delete"], * "children": [{ * "code": "tree111", * "name": "tree111", * "value": "test111Value", * "actions": ["update","read"], * }] * },{ * "code": "tree22", * "name": "tree22", * "value": "test22Value", * "actions": ["get","delete"] * }] * } * } * } * ``` * **/ public GetExternalUserResourceStructRespDto getExternalUserResourceStruct(GetExternalUserResourceStructDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-external-user-resource-struct"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, GetExternalUserResourceStructRespDto.class); } /** * @summary 判断用户在树资源同层级下的权限(推荐) * @description * ## 描述 * 此接口用于判断用户是否拥有某一树资源的**同层级下**部分的节点的某种权限。由于树类型资源比较常用,所以我们基于“判断用户是否拥有资源权限”的业务场景,新增了针对判断树这种类型资源节点权限的接口。 * ## 注意 * 我们通过`resource`参数定位到树类型数据资源的某一层级(所以该参数是按照`资源 code/节点 code 路径`格式进行传递的),并通过`resourceNodeCodes`参数定位到是当前曾经的哪些节点。 * ## 场景举例 * 假如你的业务场景是:当在一个文件系统中,用户在删除某一文件夹下某些文件,需要判断他是否拥有这些文件的删除权限,则可以使用此接口。 * ## 请求示例 * ### 判断用户在树资源同层级权限示例(无条件判断) * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "userId": "63721xxxxxxxxxxxxdde14a3", * "action": "read", * "resource": "treeResourceCode/structCode", * "resourceNodeCodes": ["resourceStructChildrenCode1","resourceStructChildrenCode2","resourceStructChildrenCode3"] * } * ``` * * ### 判断用户在树资源同层级权限示例(开启条件判断) * * ```json * { * "namespaceCode": "examplePermissionNamespace", * "userId": "63721xxxxxxxxxxxxdde14a3", * "action": "read", * "resource": "treeResourceCode/structCode", * "resourceNodeCodes": ["resourceStructChildrenCode1","resourceStructChildrenCode2","resourceStructChildrenCode3"], * "judgeConditionEnabled": true, * "authEnvParams":{ * "ip":"110.96.0.0", * "city":"北京", * "province":"北京", * "country":"中国", * "deviceType":"PC", * "systemType":"ios", * "browserType":"IE", * "requestDate":"2022-12-26 17:40:00" * } * } * ``` * **/ public CheckUserSameLevelPermissionResponseDto checkUserSameLevelPermission(CheckUserSameLevelPermissionDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/check-user-same-level-permission"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CheckUserSameLevelPermissionResponseDto.class); } /** * @summary 获取权限视图数据列表 * @description * ## 描述 * 此接口用于导出菜单:权限管理 -> 数据权限 -> 权限试图列表数据,如果你需要拉取我们数据权限的授权数据(所有用户拥有的所有资源的所有权限),则可以使用此接口。 * **/ public ListPermissionViewResponseDto listPermissionView(ListPermissionViewDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-permission-view/data"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ListPermissionViewResponseDto.class); } /** * @summary 获取套餐详情 * @description 获取当前用户池套餐详情。 **/ public CostGetCurrentPackageRespDto getCurrentPackageInfo() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-current-package-info"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, CostGetCurrentPackageRespDto.class); } /** * @summary 获取用量详情 * @description 获取当前用户池用量详情。 **/ public CostGetCurrentUsageRespDto getUsageInfo() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-usage-info"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, CostGetCurrentUsageRespDto.class); } /** * @summary 获取 MAU 使用记录 * @description 获取当前用户池 MAU 使用记录 **/ public CostGetMauPeriodUsageHistoryRespDto getMauPeriodUsageHistory(GetMauPeriodUsageHistoryDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-mau-period-usage-history"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CostGetMauPeriodUsageHistoryRespDto.class); } /** * @summary 获取所有权益 * @description 获取当前用户池所有权益 **/ public CostGetAllRightItemRespDto getAllRightsItem() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-all-rights-items"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, CostGetAllRightItemRespDto.class); } /** * @summary 获取订单列表 * @description 获取当前用户池订单列表 **/ public CostGetOrdersRespDto getOrders(GetOrdersDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-orders"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CostGetOrdersRespDto.class); } /** * @summary 获取订单详情 * @description 获取当前用户池订单详情 **/ public CostGetOrderDetailRespDto getOrderDetail(GetOrderDetailDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-order-detail"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CostGetOrderDetailRespDto.class); } /** * @summary 获取订单支付明细 * @description 获取当前用户池订单支付明细 **/ public CostGetOrderPayDetailRespDto getOrderPayDetail(GetOrderPayDetailDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-order-pay-detail"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, CostGetOrderPayDetailRespDto.class); } /** * @summary 创建自定义事件应用 * @description 创建自定义事件应用 **/ public CommonResponseDto createEventApp(CreateEventAppDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-event-app"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取事件应用列表 * @description 获取事件应用列表 **/ public EventAppPaginatedRespDto listEventApps() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-event-apps"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, EventAppPaginatedRespDto.class); } /** * @summary 获取事件列表 * @description 获取 Authing 服务支持的所有事件列表 **/ public OpenEventPaginatedRespDto listEvents(ListEventsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-events"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, OpenEventPaginatedRespDto.class); } /** * @summary 定义自定义事件 * @description 在 Authing 事件中心定义自定义事件 **/ public CommonResponseDto defineEvent(DefineEventDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/define-event"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 推送自定义事件 * @description 向 Authing 事件中心推送自定义事件 **/ public PubEventRespDto verifyEvent(PubEventDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/pub-event"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PubEventRespDto.class); } /** * @summary 认证端推送自定义事件 * @description 认证端向 Authing 事件中心推送自定义事件 **/ public PubEventRespDto pubUserEvent(PubEventDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/pub-userEvent"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PubEventRespDto.class); } /** * @summary 创建注册白名单 * @description 你需要指定注册白名单类型以及数据,来进行创建 **/ public WhitelistListRespDto addWhitelist(AddWhitelistDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/add-whitelist"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, WhitelistListRespDto.class); } /** * @summary 获取注册白名单列表 * @description 获取注册白名单列表,可选页数、分页大小来获取 **/ public WhitelistListRespDto listWhitelists(ListWhitelistDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-whitelist"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, WhitelistListRespDto.class); } /** * @summary 删除注册白名单 * @description 通过指定多个注册白名单数据,以数组的形式进行注册白名单的删除 **/ public IsSuccessDto deleteWhitelist(DeleteWhitelistDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-whitelist"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessDto.class); } /** * @summary 获取 ip 列表 * @description 分页获取 ip 列表 **/ public IpListPaginatedRespDto findIpList(IpListDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/ip-list"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, IpListPaginatedRespDto.class); } /** * @summary 创建 ip 名单 * @description 创建 ip 名单 **/ public CommonResponseDto add(IpListCreateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/ip-list"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 删除 ip 名单 * @description 删除 ip 名单 **/ /** * @summary 获取用户列表 * @description 分页获取用户列表 **/ public UserListPaginatedRespDto findUserList(UserListDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/user-list"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserListPaginatedRespDto.class); } /** * @summary 创建用户名单 * @description 创建用户名单 **/ public CommonResponseDto addUser(UserListCreateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/user-list"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 删除用户名单 * @description 删除用户 名单 **/ /** * @summary 获取风险策略列表 * @description 分页获取风险策略列表 **/ public UserListPolicyPaginatedRespDto findRiskListPolicy(RiskListPolicyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/risk-list-policy"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, UserListPolicyPaginatedRespDto.class); } /** * @summary 创建风险策略 * @description 创建风险策略 **/ public CommonResponseDto addRiskListPolicy(RiskListPolicyCreateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/risk-list-policy"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 删除风险策略 * @description 删除风险策略 **/ /** * @summary 新增设备 * @description 创建新设备。 **/ public TerminalInfoRespDto createDevice(CreateTerminalDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-device"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, TerminalInfoRespDto.class); } /** * @summary 最近登录应用 * @description 根据设备唯一标识获取最近登录的应用列表。 **/ public CommonResponseDto findLastLoginAppsByDeviceIds(QueryTerminalAppsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-last-login-apps-by-deviceIds"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 新增 verify 设备 * @description 创建 verify 新设备。 **/ public TerminalInfoRespDto createVerifyDevice(CreateTerminalDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/authing-verify/create-device"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, TerminalInfoRespDto.class); } /** * @summary 创建 Pipeline 函数 * @description 创建 Pipeline 函数 **/ public PipelineFunctionSingleRespDto createPipelineFunction(CreatePipelineFunctionDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-pipeline-function"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PipelineFunctionSingleRespDto.class); } /** * @summary 获取 Pipeline 函数详情 * @description 获取 Pipeline 函数详情 **/ public PipelineFunctionSingleRespDto getPipelineFunction(GetPipelineFunctionDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-pipeline-function"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PipelineFunctionSingleRespDto.class); } /** * @summary 重新上传 Pipeline 函数 * @description 当 Pipeline 函数上传失败时,重新上传 Pipeline 函数 **/ public PipelineFunctionSingleRespDto reuploadPipelineFunction(ReUploadPipelineFunctionDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/reupload-pipeline-function"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PipelineFunctionSingleRespDto.class); } /** * @summary 修改 Pipeline 函数 * @description 修改 Pipeline 函数 **/ public PipelineFunctionSingleRespDto updatePipelineFunction(UpdatePipelineFunctionDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-pipeline-function"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, PipelineFunctionSingleRespDto.class); } /** * @summary 修改 Pipeline 函数顺序 * @description 修改 Pipeline 函数顺序 **/ public CommonResponseDto updatePipelineOrder(UpdatePipelineOrderDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-pipeline-order"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 删除 Pipeline 函数 * @description 删除 Pipeline 函数 **/ public CommonResponseDto deletePipelineFunction(DeletePipelineFunctionDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-pipeline-function"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 获取 Pipeline 函数列表 * @description 获取 Pipeline 函数列表 **/ public PipelineFunctionPaginatedRespDto listPipelineFunctions(ListPipelineFunctionsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-pipeline-functions"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PipelineFunctionPaginatedRespDto.class); } /** * @summary 获取 Pipeline 日志 * @description 获取 Pipeline **/ public PipelineFunctionPaginatedRespDto getPipelineLogs(GetPipelineLogsDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-pipeline-logs"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, PipelineFunctionPaginatedRespDto.class); } /** * @summary 创建 Webhook * @description 你需要指定 Webhook 名称、Webhook 回调地址、请求数据格式、用户真实名称来创建 Webhook。还可选是否启用、请求密钥进行创建 **/ public CreateWebhookRespDto createWebhook(CreateWebhookDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-webhook"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateWebhookRespDto.class); } /** * @summary 获取 Webhook 列表 * @description 获取 Webhook 列表,可选页数、分页大小来获取 **/ public GetWebhooksRespDto listWebhooks(ListWebhooksDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-webhooks"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetWebhooksRespDto.class); } /** * @summary 修改 Webhook 配置 * @description 需要指定 webhookId,可选 Webhook 名称、Webhook 回调地址、请求数据格式、用户真实名称、是否启用、请求密钥参数进行修改 webhook **/ public UpdateWebhooksRespDto updateWebhook(UpdateWebhookDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-webhook"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, UpdateWebhooksRespDto.class); } /** * @summary 删除 Webhook * @description 通过指定多个 webhookId,以数组的形式进行 webhook 的删除,如果 webhookId 不存在,不提示报错 **/ public DeleteWebhookRespDto deleteWebhook(DeleteWebhookDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-webhook"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, DeleteWebhookRespDto.class); } /** * @summary 获取 Webhook 日志 * @description 通过指定 webhookId,可选 page 和 limit 来获取 webhook 日志,如果 webhookId 不存在,不返回报错信息 **/ public ListWebhookLogsRespDto getWebhookLogs(ListWebhookLogs reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-webhook-logs"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, ListWebhookLogsRespDto.class); } /** * @summary 手动触发 Webhook 执行 * @description 通过指定 webhookId,可选请求头和请求体进行手动触发 webhook 执行 **/ public TriggerWebhookRespDto triggerWebhook(TriggerWebhookDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/trigger-webhook"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, TriggerWebhookRespDto.class); } /** * @summary 获取 Webhook 详情 * @description 根据指定的 webhookId 获取 webhook 详情 **/ public GetWebhookRespDto getWebhook(GetWebhookDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-webhook"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetWebhookRespDto.class); } /** * @summary 获取 Webhook 事件列表 * @description 返回事件列表和分类列表 **/ public WebhookEventListRespDto getWebhookEventList() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-webhook-event-list"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, WebhookEventListRespDto.class); } /** * @summary 生成 LDAP Server 管理员密码 * @description 生成 LDAP Server 管理员密码 **/ public LdapGetBindPwdRespDto getBindPwd() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-ldap-server-random-pwd"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, LdapGetBindPwdRespDto.class); } /** * @summary 获取 LDAP server 配置信息 * @description 获取 LDAP server 配置信息 **/ public LdapConfigInfoRespDto queryLdapConfigInfo() { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-ldap-server-config"); config.setBody(new Object()); config.setMethod("GET"); String response = request(config); return deserialize(response, LdapConfigInfoRespDto.class); } /** * @summary 更新 LDAP server 配置信息 * @description 更新 LDAP server 配置信息 **/ public LdapOperateRespDto updateLdapConfigInfo(LdapUpdateDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-ldap-server-config"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, LdapOperateRespDto.class); } /** * @summary 初始化/重启 LDAP server * @description 初始化/重启 LDAP server **/ public LdapOperateRespDto saveLdapConfigInfo(LdapSaveDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/enable-ldap-server"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, LdapOperateRespDto.class); } /** * @summary 关闭 LDAP server 服务,关闭前必须先初始化 * @description 关闭 LDAP server 服务,关闭前必须先初始化 **/ public LdapOperateRespDto disableLdapServer(LdapSetEnabledFlagDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/disable-ldap-server"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, LdapOperateRespDto.class); } /** * @summary LDAP server 日志查询 * @description LDAP server 日志查询 **/ public LdapLogRespDto queryLdapLog(GetLdapServerLogDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-ldap-server-log"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, LdapLogRespDto.class); } /** * @summary LDAP server 根据 DN 查询下一级 * @description LDAP server 根据 DN 查询下一级 **/ public LdapLogRespDto queryLdapSubEntries(GetLdapSubEntriesDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-ldap-sub-entries"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, LdapLogRespDto.class); } /** * @summary 获取协作管理员 AK/SK 列表 * @description 根据协作管理员 Id 获取协作管理员下所有的 AK/SK 列表 **/ public ListAccessKeyResponseDto getAccessKeyList(ListAccessKeyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/list-access-key"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ListAccessKeyResponseDto.class); } /** * @summary 获取协作管理员 AK/SK 详细信息 * @description 获取协作管理员 AK/SK 详细信息,根据协作管理员 ID 和 accessKeyId 获取对应 AK/SK 的详细信息。 **/ public GetAccessKeyResponseDto getAccessKey(GetAccessKeyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/get-access-key"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, GetAccessKeyResponseDto.class); } /** * @summary 创建协作管理员的 AK/SK * @description 创建协作管理员的 AK/SK,根据协作管理员 ID 生成指定的 AK/SK。 **/ public CreateAccessKeyResponseDto createAccessKey(CreateAccessKeyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/create-access-key"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CreateAccessKeyResponseDto.class); } /** * @summary 删除协作管理员的 AK/SK * @description 删除协作管理员的 AK/SK,根据所选择的 AK/SK 的 accessKeyId 进行指定删除。 **/ public CommonResponseDto deleteAccessKey(DeleteAccessKeyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/delete-access-key"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, CommonResponseDto.class); } /** * @summary 更新一个管理员 AccessKey * @description 根据 AccessKeyId 更新一个管理员 AccessKey,目前只支持更新 status,status 支持 activated / revoked **/ public IsSuccessRespDto updateAccessKey(UpdateAccessKeyDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/update-access-key"); config.setBody(reqDto); config.setMethod("POST"); String response = request(config); return deserialize(response, IsSuccessRespDto.class); } /** * @summary 获取 verify-config-app 列表 * @description 获取 verify-config-app 列表 **/ public ApplicationDto getVerifyConfigApp(VerifyConfigAppDto reqDto) { AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/verify-config-app"); config.setBody(reqDto); config.setMethod("GET"); String response = request(config); return deserialize(response, ApplicationDto.class); } @Override public void subEvent(String eventCode, Receiver receiver) { if (StrUtil.isBlank(eventCode)) { throw new IllegalArgumentException("eventCode is required"); } if (receiver == null) { throw new IllegalArgumentException("receiver is required"); } ManagementClientOptions options = (ManagementClientOptions) this.options; String eventUri = options.getWebsocketHost()+options.getWebsocketEndpoint()+"?code="+eventCode; URI wssUri = null; try { wssUri = new URI(eventUri); } catch (URISyntaxException e) { throw new RuntimeException(e); } // System.out.println("eventUri:"+eventUri); SignatureComposer signatureComposer = new SignatureComposer(); HashMap<String,String> query = new HashMap<String, String>(); String signa = signatureComposer.composeStringToSign("websocket","",query,query); // String signa = signatureComposer.composeStringToSign("websocket",eventUri,query,query); // server 端验证不用传 uri // System.out.println("signa:"+signa); String authorization = signatureComposer.getAuthorization(options.getAccessKeyId(),options.getAccessKeySecret(),signa); // System.out.println(authorization); HashMap<String,String> headers = new HashMap(); headers.put("Authorization",authorization); AuthingWebsocketClient client = new AuthingWebsocketClient(wssUri,headers,receiver); client.connect(); } public CostGetAllRightItemRespDto pubtEvent(String eventCode,Object data){ Assert.notNull(eventCode); Assert.notNull(data); AuthingRequestConfig config = new AuthingRequestConfig(); config.setUrl("/api/v3/pub-event"); config.setBody(new EventDto(eventCode,data)); config.setMethod("POST"); String response = request(config); return deserialize(response, CostGetAllRightItemRespDto.class); } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AccessTokenDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AccessTokenDto { }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AccessTokenResDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AccessTokenResDto { /** * Access Token 内容 */ @JsonProperty("access_token") private String accessToken; /** * access_token 有效时间,默认为 7200 秒(两小时),过期之后应该重新获取新的 access_token。 */ @JsonProperty("expires_in") private Integer expiresIn; public String getAccessToken() { return accessToken; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public Integer getExpiresIn() { return expiresIn; } public void setExpiresIn(Integer expiresIn) { this.expiresIn = expiresIn; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AccessibleAppsDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AccessibleAppsDto { /** * 应用 ID */ @JsonProperty("appId") private String appId; /** * 应用名称 */ @JsonProperty("appName") private String appName; /** * 应用登录地址 */ @JsonProperty("appLoginUrl") private String appLoginUrl; /** * 应用 Logo */ @JsonProperty("appLogo") private String appLogo; /** * 当前是否处于登录态 */ @JsonProperty("active") private Boolean active; public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } public String getAppName() { return appName; } public void setAppName(String appName) { this.appName = appName; } public String getAppLoginUrl() { return appLoginUrl; } public void setAppLoginUrl(String appLoginUrl) { this.appLoginUrl = appLoginUrl; } public String getAppLogo() { return appLogo; } public void setAppLogo(String appLogo) { this.appLogo = appLogo; } public Boolean getActive() { return active; } public void setActive(Boolean active) { this.active = active; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ActionAuth.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ActionAuth { /** * 数据策略授权用户 ID 列表 */ @JsonProperty("userIds") private List<String> userIds; /** * 数据资源权限操作 */ @JsonProperty("action") private String action; public List<String> getUserIds() { return userIds; } public void setUserIds(List<String> userIds) { this.userIds = userIds; } public String getAction() { return action; } public void setAction(String action) { this.action = action; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AddApplicationPermissionRecord.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AddApplicationPermissionRecord { /** * 授权主体列表,最多 10 条 */ @JsonProperty("list") private List<ApplicationPermissionRecordItem> list; /** * 应用 ID */ @JsonProperty("appId") private String appId; public List<ApplicationPermissionRecordItem> getList() { return list; } public void setList(List<ApplicationPermissionRecordItem> list) { this.list = list; } public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AddDepartmentMembersReqDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AddDepartmentMembersReqDto { /** * 用户 ID 列表 */ @JsonProperty("userIds") private List<String> userIds; /** * 组织 code */ @JsonProperty("organizationCode") private String organizationCode; /** * 部门系统 ID(为 Authing 系统自动生成,不可修改) */ @JsonProperty("departmentId") private String departmentId; /** * 此次调用中使用的部门 ID 的类型 */ @JsonProperty("departmentIdType") private DepartmentIdType departmentIdType; /** * 租户 ID */ @JsonProperty("tenantId") private String tenantId; public List<String> getUserIds() { return userIds; } public void setUserIds(List<String> userIds) { this.userIds = userIds; } public String getOrganizationCode() { return organizationCode; } public void setOrganizationCode(String organizationCode) { this.organizationCode = organizationCode; } public String getDepartmentId() { return departmentId; } public void setDepartmentId(String departmentId) { this.departmentId = departmentId; } public DepartmentIdType getDepartmentIdType() { return departmentIdType; } public void setDepartmentIdType(DepartmentIdType departmentIdType) { this.departmentIdType = departmentIdType; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } /** * 此次调用中使用的部门 ID 的类型 */ public static enum DepartmentIdType { @JsonProperty("department_id") DEPARTMENT_ID("department_id"), @JsonProperty("open_department_id") OPEN_DEPARTMENT_ID("open_department_id"), @JsonProperty("sync_relation") SYNC_RELATION("sync_relation"), @JsonProperty("custom_field") CUSTOM_FIELD("custom_field"), @JsonProperty("code") CODE("code"), ; private String value; DepartmentIdType(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AddGroupMembersReqDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AddGroupMembersReqDto { /** * 用户 ID 数组 */ @JsonProperty("userIds") private List<String> userIds; /** * 分组 code */ @JsonProperty("code") private String code; public List<String> getUserIds() { return userIds; } public void setUserIds(List<String> userIds) { this.userIds = userIds; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AddTenantDepartmentMembersReqDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AddTenantDepartmentMembersReqDto { /** * 组织 code */ @JsonProperty("organizationCode") private String organizationCode; /** * 部门系统 ID(为 Authing 系统自动生成,不可修改) */ @JsonProperty("departmentId") private String departmentId; /** * 此次调用中使用的部门 ID 的类型 */ @JsonProperty("departmentIdType") private DepartmentIdType departmentIdType; /** * 关联的用户池级别的用户 ID */ @JsonProperty("linkUserIds") private List<String> linkUserIds; /** * 租户成员 ID */ @JsonProperty("memberIds") private List<String> memberIds; /** * 租户 ID */ @JsonProperty("tenantId") private String tenantId; public String getOrganizationCode() { return organizationCode; } public void setOrganizationCode(String organizationCode) { this.organizationCode = organizationCode; } public String getDepartmentId() { return departmentId; } public void setDepartmentId(String departmentId) { this.departmentId = departmentId; } public DepartmentIdType getDepartmentIdType() { return departmentIdType; } public void setDepartmentIdType(DepartmentIdType departmentIdType) { this.departmentIdType = departmentIdType; } public List<String> getLinkUserIds() { return linkUserIds; } public void setLinkUserIds(List<String> linkUserIds) { this.linkUserIds = linkUserIds; } public List<String> getMemberIds() { return memberIds; } public void setMemberIds(List<String> memberIds) { this.memberIds = memberIds; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } /** * 此次调用中使用的部门 ID 的类型 */ public static enum DepartmentIdType { @JsonProperty("department_id") DEPARTMENT_ID("department_id"), @JsonProperty("open_department_id") OPEN_DEPARTMENT_ID("open_department_id"), @JsonProperty("sync_relation") SYNC_RELATION("sync_relation"), @JsonProperty("custom_field") CUSTOM_FIELD("custom_field"), @JsonProperty("code") CODE("code"), ; private String value; DepartmentIdType(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AddTenantUsersDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AddTenantUsersDto { /** * 关联的用户池级别的用户 ID */ @JsonProperty("linkUserIds") private List<String> linkUserIds; /** * 租户 ID */ @JsonProperty("tenantId") private String tenantId; public List<String> getLinkUserIds() { return linkUserIds; } public void setLinkUserIds(List<String> linkUserIds) { this.linkUserIds = linkUserIds; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AddWhitelistDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AddWhitelistDto { /** * 白名单类型 */ @JsonProperty("type") private Type type; /** * 类型参数 */ @JsonProperty("list") private List<String> list; public Type getType() { return type; } public void setType(Type type) { this.type = type; } public List<String> getList() { return list; } public void setList(List<String> list) { this.list = list; } /** * 白名单类型 */ public static enum Type { @JsonProperty("USERNAME") USERNAME("USERNAME"), @JsonProperty("EMAIL") EMAIL("EMAIL"), @JsonProperty("PHONE") PHONE("PHONE"), ; private String value; Type(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AdminAuditLogDto.java
package ai.genauth.sdk.java.dto; import com.fasterxml.jackson.annotation.JsonProperty; public class AdminAuditLogDto { /** * 管理员的用户 ID */ @JsonProperty("adminUserId") private String adminUserId; /** * 管理员用户头像 */ @JsonProperty("adminUserAvatar") private String adminUserAvatar; /** * 管理员用户显示名称,按照以下用户字段顺序进行展示:nickname > username > name > givenName > familyName -> email -> phone -> id */ @JsonProperty("adminUserDisplayName") private String adminUserDisplayName; /** * 客户端 IP,可根据登录时的客户端 IP 进行筛选。默认不传获取所有登录 IP 的登录历史。 */ @JsonProperty("clientIp") private String clientIp; /** * 操作类型: * - `create`: 创建 * - `delete`: 删除 * - `import`: 导入 * - `export`: 导出 * - `update`: 修改 * - `refresh`: 刷新 * - `sync`: 同步 * - `invite`: 邀请 * - `resign`: 离职 * - `recover`: 恢复 * - `disable`: 禁用 * - `userEnable`: 启用 * */ @JsonProperty("operationType") private OperationType operationType; /** * 事件类型: * - `user`: 用户 * - `userpool`: 用户池 * - `tenant`: 租户 * - `userLoginState`: 用户登录态 * - `userAccountState`: 用户账号状态 * - `userGroup`: 用户分组 * - `fieldEncryptState`: 字段加密状态 * - `syncTask`: 同步任务 * - `socialConnection`: 社会化身份源 * - `enterpriseConnection`: 社会化身份源 * - `customDatabase`: 自定义数据库 * - `org`: 组织机构 * - `cooperator`: 协作管理员 * - `application`: 应用 * - `resourceNamespace`: 权限分组 * - `resource`: 资源 * - `role`: 角色 * - `roleAssign`: 角色授权 * - `policy`: 策略 * */ @JsonProperty("resourceType") private ResourceType resourceType; /** * 事件详情 */ @JsonProperty("eventDetail") private String eventDetail; /** * 具体的操作参数 */ @JsonProperty("operationParam") private String operationParam; /** * 原始值 */ @JsonProperty("originValue") private String originValue; /** * 新值 */ @JsonProperty("targetValue") private String targetValue; /** * 是否成功 */ @JsonProperty("success") private Boolean success; /** * User Agent */ @JsonProperty("userAgent") private String userAgent; /** * 解析过后的 User Agent */ @JsonProperty("parsedUserAgent") private ParsedUserAgent parsedUserAgent; /** * 地理位置 */ @JsonProperty("geoip") private GeoIp geoip; /** * 时间 */ @JsonProperty("timestamp") private String timestamp; /** * 请求 ID */ @JsonProperty("requestId") private String requestId; public String getAdminUserId() { return adminUserId; } public void setAdminUserId(String adminUserId) { this.adminUserId = adminUserId; } public String getAdminUserAvatar() { return adminUserAvatar; } public void setAdminUserAvatar(String adminUserAvatar) { this.adminUserAvatar = adminUserAvatar; } public String getAdminUserDisplayName() { return adminUserDisplayName; } public void setAdminUserDisplayName(String adminUserDisplayName) { this.adminUserDisplayName = adminUserDisplayName; } public String getClientIp() { return clientIp; } public void setClientIp(String clientIp) { this.clientIp = clientIp; } public OperationType getOperationType() { return operationType; } public void setOperationType(OperationType operationType) { this.operationType = operationType; } public ResourceType getResourceType() { return resourceType; } public void setResourceType(ResourceType resourceType) { this.resourceType = resourceType; } public String getEventDetail() { return eventDetail; } public void setEventDetail(String eventDetail) { this.eventDetail = eventDetail; } public String getOperationParam() { return operationParam; } public void setOperationParam(String operationParam) { this.operationParam = operationParam; } public String getOriginValue() { return originValue; } public void setOriginValue(String originValue) { this.originValue = originValue; } public String getTargetValue() { return targetValue; } public void setTargetValue(String targetValue) { this.targetValue = targetValue; } public Boolean getSuccess() { return success; } public void setSuccess(Boolean success) { this.success = success; } public String getUserAgent() { return userAgent; } public void setUserAgent(String userAgent) { this.userAgent = userAgent; } public ParsedUserAgent getParsedUserAgent() { return parsedUserAgent; } public void setParsedUserAgent(ParsedUserAgent parsedUserAgent) { this.parsedUserAgent = parsedUserAgent; } public GeoIp getGeoip() { return geoip; } public void setGeoip(GeoIp geoip) { this.geoip = geoip; } public String getTimestamp() { return timestamp; } public void setTimestamp(String timestamp) { this.timestamp = timestamp; } public String getRequestId() { return requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } /** * 操作类型: * - `create`: 创建 * - `delete`: 删除 * - `import`: 导入 * - `export`: 导出 * - `update`: 修改 * - `refresh`: 刷新 * - `sync`: 同步 * - `invite`: 邀请 * - `resign`: 离职 * - `recover`: 恢复 * - `disable`: 禁用 * - `userEnable`: 启用 * */ public static enum OperationType { @JsonProperty("all") ALL("all"), @JsonProperty("create") CREATE("create"), @JsonProperty("delete") DELETE("delete"), @JsonProperty("import") IMPORT("import"), @JsonProperty("export") EXPORT("export"), @JsonProperty("update") UPDATE("update"), @JsonProperty("refresh") REFRESH("refresh"), @JsonProperty("sync") SYNC("sync"), @JsonProperty("invite") INVITE("invite"), @JsonProperty("resign") RESIGN("resign"), @JsonProperty("recover") RECOVER("recover"), @JsonProperty("disable") DISABLE("disable"), @JsonProperty("enable") ENABLE("enable"), @JsonProperty("activate") ACTIVATE("activate"), @JsonProperty("deactivate") DEACTIVATE("deactivate"), @JsonProperty("add") ADD("add"), @JsonProperty("remove") REMOVE("remove"), @JsonProperty("query") QUERY("query"), ; private String value; OperationType(String value) { this.value = value; } public String getValue() { return value; } } /** * 事件类型: * - `user`: 用户 * - `userpool`: 用户池 * - `tenant`: 租户 * - `userLoginState`: 用户登录态 * - `userAccountState`: 用户账号状态 * - `userGroup`: 用户分组 * - `fieldEncryptState`: 字段加密状态 * - `syncTask`: 同步任务 * - `socialConnection`: 社会化身份源 * - `enterpriseConnection`: 社会化身份源 * - `customDatabase`: 自定义数据库 * - `org`: 组织机构 * - `cooperator`: 协作管理员 * - `application`: 应用 * - `resourceNamespace`: 权限分组 * - `resource`: 资源 * - `role`: 角色 * - `roleAssign`: 角色授权 * - `policy`: 策略 * */ public static enum ResourceType { @JsonProperty("all") ALL("all"), @JsonProperty("user") USER("user"), @JsonProperty("userpool") USERPOOL("userpool"), @JsonProperty("tenant") TENANT("tenant"), @JsonProperty("userLoginState") USER_LOGIN_STATE("userLoginState"), @JsonProperty("userAccountState") USER_ACCOUNT_STATE("userAccountState"), @JsonProperty("userGroup") USER_GROUP("userGroup"), @JsonProperty("fieldEncryptState") FIELD_ENCRYPT_STATE("fieldEncryptState"), @JsonProperty("syncTask") SYNC_TASK("syncTask"), @JsonProperty("socialConnection") SOCIAL_CONNECTION("socialConnection"), @JsonProperty("enterpriseConnection") ENTERPRISE_CONNECTION("enterpriseConnection"), @JsonProperty("customDatabase") CUSTOM_DATABASE("customDatabase"), @JsonProperty("org") ORG("org"), @JsonProperty("cooperator") COOPERATOR("cooperator"), @JsonProperty("application") APPLICATION("application"), @JsonProperty("resourceNamespace") RESOURCE_NAMESPACE("resourceNamespace"), @JsonProperty("resource") RESOURCE("resource"), @JsonProperty("role") ROLE("role"), @JsonProperty("roleAssign") ROLE_ASSIGN("roleAssign"), @JsonProperty("policy") POLICY("policy"), @JsonProperty("customDomain") CUSTOM_DOMAIN("customDomain"), @JsonProperty("permitSpace") PERMIT_SPACE("permitSpace"), @JsonProperty("generalResource") GENERAL_RESOURCE("generalResource"), @JsonProperty("generalResourceAuthorization") GENERAL_RESOURCE_AUTHORIZATION("generalResourceAuthorization"), @JsonProperty("roleSubject") ROLE_SUBJECT("roleSubject"), @JsonProperty("subjectOfRole") SUBJECT_OF_ROLE("subjectOfRole"), @JsonProperty("dataResource") DATA_RESOURCE("dataResource"), @JsonProperty("dataPolicy") DATA_POLICY("dataPolicy"), @JsonProperty("authorization") AUTHORIZATION("authorization"), @JsonProperty("userAuthorization") USER_AUTHORIZATION("userAuthorization"), ; private String value; ResourceType(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AdminAuditLogRespData.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AdminAuditLogRespData { /** * 记录总数 */ @JsonProperty("totalCount") private Integer totalCount; /** * 返回列表 */ @JsonProperty("list") private List<AdminAuditLogDto> list; public Integer getTotalCount() { return totalCount; } public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; } public List<AdminAuditLogDto> getList() { return list; } public void setList(List<AdminAuditLogDto> list) { this.list = list; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AdminAuditLogRespDto.java
package ai.genauth.sdk.java.dto; import com.fasterxml.jackson.annotation.JsonProperty; public class AdminAuditLogRespDto { /** * 业务状态码,可以通过此状态码判断操作是否成功,200 表示成功。 */ @JsonProperty("statusCode") private Integer statusCode; /** * 描述信息 */ @JsonProperty("message") private String message; /** * 细分错误码,可通过此错误码得到具体的错误类型(成功请求不返回)。详细错误码列表请见:[API Code 列表](https://api-explorer.authing.cn/?tag=group/%E5%BC%80%E5%8F%91%E5%87%86%E5%A4%87#tag/%E5%BC%80%E5%8F%91%E5%87%86%E5%A4%87/%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/apiCode) */ @JsonProperty("apiCode") private Integer apiCode; /** * 请求 ID。当请求失败时会返回。 */ @JsonProperty("requestId") private String requestId; /** * 响应数据 */ @JsonProperty("data") private AdminAuditLogRespData data; public Integer getStatusCode() { return statusCode; } public void setStatusCode(Integer statusCode) { this.statusCode = statusCode; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public Integer getApiCode() { return apiCode; } public void setApiCode(Integer apiCode) { this.apiCode = apiCode; } public String getRequestId() { return requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public AdminAuditLogRespData getData() { return data; } public void setData(AdminAuditLogRespData data) { this.data = data; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AliExmailEmailProviderConfig.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AliExmailEmailProviderConfig { /** * 用户名 */ @JsonProperty("sender") private String sender; /** * 密码 */ @JsonProperty("senderPass") private String senderPass; public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public String getSenderPass() { return senderPass; } public void setSenderPass(String senderPass) { this.senderPass = senderPass; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AliExmailEmailProviderConfigInput.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AliExmailEmailProviderConfigInput { /** * 用户名 */ @JsonProperty("sender") private String sender; /** * 密码 */ @JsonProperty("senderPass") private String senderPass; public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public String getSenderPass() { return senderPass; } public void setSenderPass(String senderPass) { this.senderPass = senderPass; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AlipayAuthInfoDataDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AlipayAuthInfoDataDto { /** * 拉起支付宝需要的 AuthInfo */ @JsonProperty("authInfo") private String authInfo; public String getAuthInfo() { return authInfo; } public void setAuthInfo(String authInfo) { this.authInfo = authInfo; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AllOperateDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AllOperateDto { /** * model Id */ @JsonProperty("modelId") private String modelId; public String getModelId() { return modelId; } public void setModelId(String modelId) { this.modelId = modelId; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/Any.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class Any { }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AppDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AppDto { /** * App ID */ @JsonProperty("appId") private String appId; /** * App 名称 */ @JsonProperty("appName") private String appName; /** * App Logo */ @JsonProperty("appLogo") private String appLogo; /** * App 登录地址 */ @JsonProperty("appLoginUrl") private String appLoginUrl; /** * App 默认的登录策略 */ @JsonProperty("appDefaultLoginStrategy") private AppDefaultLoginStrategy appDefaultLoginStrategy; public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } public String getAppName() { return appName; } public void setAppName(String appName) { this.appName = appName; } public String getAppLogo() { return appLogo; } public void setAppLogo(String appLogo) { this.appLogo = appLogo; } public String getAppLoginUrl() { return appLoginUrl; } public void setAppLoginUrl(String appLoginUrl) { this.appLoginUrl = appLoginUrl; } public AppDefaultLoginStrategy getAppDefaultLoginStrategy() { return appDefaultLoginStrategy; } public void setAppDefaultLoginStrategy(AppDefaultLoginStrategy appDefaultLoginStrategy) { this.appDefaultLoginStrategy = appDefaultLoginStrategy; } /** * App 默认的登录策略 */ public static enum AppDefaultLoginStrategy { @JsonProperty("ALLOW_ALL") ALLOW_ALL("ALLOW_ALL"), @JsonProperty("DENY_ALL") DENY_ALL("DENY_ALL"), ; private String value; AppDefaultLoginStrategy(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AppListRespDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AppListRespDto { /** * 业务状态码,可以通过此状态码判断操作是否成功,200 表示成功。 */ @JsonProperty("statusCode") private Integer statusCode; /** * 描述信息 */ @JsonProperty("message") private String message; /** * 细分错误码,可通过此错误码得到具体的错误类型(成功请求不返回)。详细错误码列表请见:[API Code 列表](https://api-explorer.authing.cn/?tag=group/%E5%BC%80%E5%8F%91%E5%87%86%E5%A4%87#tag/%E5%BC%80%E5%8F%91%E5%87%86%E5%A4%87/%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/apiCode) */ @JsonProperty("apiCode") private Integer apiCode; /** * 请求 ID。当请求失败时会返回。 */ @JsonProperty("requestId") private String requestId; /** * 响应数据 */ @JsonProperty("data") private List<AppDto> data; public Integer getStatusCode() { return statusCode; } public void setStatusCode(Integer statusCode) { this.statusCode = statusCode; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public Integer getApiCode() { return apiCode; } public void setApiCode(Integer apiCode) { this.apiCode = apiCode; } public String getRequestId() { return requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public List<AppDto> getData() { return data; } public void setData(List<AppDto> data) { this.data = data; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/AppQRCodeLoginDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class AppQRCodeLoginDto { /** * APP 扫二维码登录: * - `APP_LOGIN`: APP 扫码登录; * */ @JsonProperty("action") private Action action; /** * 二维码唯一 ID */ @JsonProperty("qrcodeId") private String qrcodeId; public Action getAction() { return action; } public void setAction(Action action) { this.action = action; } public String getQrcodeId() { return qrcodeId; } public void setQrcodeId(String qrcodeId) { this.qrcodeId = qrcodeId; } /** * APP 扫二维码登录: * - `APP_LOGIN`: APP 扫码登录; * */ public static enum Action { @JsonProperty("APP_LOGIN") APP_LOGIN("APP_LOGIN"), ; private String value; Action(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationAgreementDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationAgreementDto { /** * 展示的页面(可多选): * - `LoginPage`: 登录页面 * - `RegisterPage`: 注册页面 * */ @JsonProperty("displayAt") private List<String> displayAt; /** * 是否要求必须勾选 */ @JsonProperty("isRequired") private Boolean isRequired; /** * 此协议针对什么语言有效: * - `zh-CN`: 简体中文 * - `zh-TW`: 繁体中文 * - `en-US`: 英文 * - `ja-JP`: 日语 * */ @JsonProperty("lang") private Lang lang; /** * 此协议针对什么语言有效 */ @JsonProperty("content") private String content; public List<String> getDisplayAt() { return displayAt; } public void setDisplayAt(List<String> displayAt) { this.displayAt = displayAt; } public Boolean getIsRequired() { return isRequired; } public void setIsRequired(Boolean isRequired) { this.isRequired = isRequired; } public Lang getLang() { return lang; } public void setLang(Lang lang) { this.lang = lang; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } /** * 此协议针对什么语言有效: * - `zh-CN`: 简体中文 * - `zh-TW`: 繁体中文 * - `en-US`: 英文 * - `ja-JP`: 日语 * */ public static enum Lang { @JsonProperty("zh-CN") ZH_CN("zh-CN"), @JsonProperty("en-US") EN_US("en-US"), @JsonProperty("zh-TW") ZH_TW("zh-TW"), @JsonProperty("ja-JP") JA_JP("ja-JP"), ; private String value; Lang(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationBrandingConfig.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationBrandingConfig { /** * 是否开启自定义 CSS */ @JsonProperty("customCSSEnabled") private Boolean customCSSEnabled; /** * 自定义 CSS 内容 */ @JsonProperty("customCSS") private String customCSS; /** * Guard 版本: * - `Advanced`: 高级版 * - `Classical`: 经典版 * */ @JsonProperty("guardVersion") private GuardVersion guardVersion; /** * 自定义加载图标,当登录框加载时会展示 */ @JsonProperty("customLoadingImage") private String customLoadingImage; /** * 自定义登录页背景,示例: * - 图片背景:`url(https://files.authing.co/user-contents/photos/6c6b3726-4a04-4ba7-b686-1a275f81a47a.png) center/cover` * - 纯色背景:`rgba(37,49,122,1)` * */ @JsonProperty("customBackground") private String customBackground; /** * 是否显示切换语言按钮 */ @JsonProperty("showChangeLanguageButton") private Boolean showChangeLanguageButton; /** * 默认语言: * - `zh-CN`: 简体中文 * - `zh-TW`: 繁体中文 * - `en-US`: 英文 * - `ja-JP`: 日语 * */ @JsonProperty("defaultLanguage") private DefaultLanguage defaultLanguage; /** * 是否显示忘记密码按钮 */ @JsonProperty("showForgetPasswordButton") private Boolean showForgetPasswordButton; /** * 是否显示企业身份源登录方式 */ @JsonProperty("showEnterpriseConnections") private Boolean showEnterpriseConnections; /** * 是否显示社会化登录方式 */ @JsonProperty("showSocialConnections") private Boolean showSocialConnections; /** * 是否展示登录注册协议 */ @JsonProperty("showAgreement") private Boolean showAgreement; /** * 展示的登录注册协议列表 */ @JsonProperty("agreements") private List<ApplicationAgreementDto> agreements; public Boolean getCustomCSSEnabled() { return customCSSEnabled; } public void setCustomCSSEnabled(Boolean customCSSEnabled) { this.customCSSEnabled = customCSSEnabled; } public String getCustomCSS() { return customCSS; } public void setCustomCSS(String customCSS) { this.customCSS = customCSS; } public GuardVersion getGuardVersion() { return guardVersion; } public void setGuardVersion(GuardVersion guardVersion) { this.guardVersion = guardVersion; } public String getCustomLoadingImage() { return customLoadingImage; } public void setCustomLoadingImage(String customLoadingImage) { this.customLoadingImage = customLoadingImage; } public String getCustomBackground() { return customBackground; } public void setCustomBackground(String customBackground) { this.customBackground = customBackground; } public Boolean getShowChangeLanguageButton() { return showChangeLanguageButton; } public void setShowChangeLanguageButton(Boolean showChangeLanguageButton) { this.showChangeLanguageButton = showChangeLanguageButton; } public DefaultLanguage getDefaultLanguage() { return defaultLanguage; } public void setDefaultLanguage(DefaultLanguage defaultLanguage) { this.defaultLanguage = defaultLanguage; } public Boolean getShowForgetPasswordButton() { return showForgetPasswordButton; } public void setShowForgetPasswordButton(Boolean showForgetPasswordButton) { this.showForgetPasswordButton = showForgetPasswordButton; } public Boolean getShowEnterpriseConnections() { return showEnterpriseConnections; } public void setShowEnterpriseConnections(Boolean showEnterpriseConnections) { this.showEnterpriseConnections = showEnterpriseConnections; } public Boolean getShowSocialConnections() { return showSocialConnections; } public void setShowSocialConnections(Boolean showSocialConnections) { this.showSocialConnections = showSocialConnections; } public Boolean getShowAgreement() { return showAgreement; } public void setShowAgreement(Boolean showAgreement) { this.showAgreement = showAgreement; } public List<ApplicationAgreementDto> getAgreements() { return agreements; } public void setAgreements(List<ApplicationAgreementDto> agreements) { this.agreements = agreements; } /** * Guard 版本: * - `Advanced`: 高级版 * - `Classical`: 经典版 * */ public static enum GuardVersion { @JsonProperty("Advanced") ADVANCED("Advanced"), @JsonProperty("Classical") CLASSICAL("Classical"), ; private String value; GuardVersion(String value) { this.value = value; } public String getValue() { return value; } } /** * 默认语言: * - `zh-CN`: 简体中文 * - `zh-TW`: 繁体中文 * - `en-US`: 英文 * - `ja-JP`: 日语 * */ public static enum DefaultLanguage { @JsonProperty("zh-CN") ZH_CN("zh-CN"), @JsonProperty("en-US") EN_US("en-US"), @JsonProperty("zh-TW") ZH_TW("zh-TW"), @JsonProperty("ja-JP") JA_JP("ja-JP"), ; private String value; DefaultLanguage(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationBrandingConfigInputDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationBrandingConfigInputDto { /** * 是否开启自定义 CSS */ @JsonProperty("customCSSEnabled") private Boolean customCSSEnabled; /** * 自定义 CSS 内容 */ @JsonProperty("customCSS") private String customCSS; /** * Guard 版本: * - `Advanced`: 高级版 * - `Classical`: 经典版 * */ @JsonProperty("guardVersion") private GuardVersion guardVersion; /** * 自定义加载图标,当登录框加载时会展示 */ @JsonProperty("customLoadingImage") private String customLoadingImage; /** * 自定义登录页背景,示例: * - 图片背景:`url(https://files.authing.co/user-contents/photos/6c6b3726-4a04-4ba7-b686-1a275f81a47a.png) center/cover` * - 纯色背景:`rgba(37,49,122,1)` * */ @JsonProperty("customBackground") private String customBackground; /** * 是否显示切换语言按钮 */ @JsonProperty("showChangeLanguageButton") private Boolean showChangeLanguageButton; /** * 展示的默认语言: * - `zh-CN`: 简体中文 * - `zh-TW`: 繁体中文 * - `en-US`: 英文 * - `ja-JP`: 日语 * * 默认情况下,Authing 登录页会根据用户浏览器语言自动渲染。 * */ @JsonProperty("defaultLanguage") private DefaultLanguage defaultLanguage; /** * 是否显示忘记密码按钮 */ @JsonProperty("showForgetPasswordButton") private Boolean showForgetPasswordButton; /** * 是否显示企业身份源登录方式 */ @JsonProperty("showEnterpriseConnections") private Boolean showEnterpriseConnections; /** * 是否显示社会化登录方式 */ @JsonProperty("showSocialConnections") private Boolean showSocialConnections; public Boolean getCustomCSSEnabled() { return customCSSEnabled; } public void setCustomCSSEnabled(Boolean customCSSEnabled) { this.customCSSEnabled = customCSSEnabled; } public String getCustomCSS() { return customCSS; } public void setCustomCSS(String customCSS) { this.customCSS = customCSS; } public GuardVersion getGuardVersion() { return guardVersion; } public void setGuardVersion(GuardVersion guardVersion) { this.guardVersion = guardVersion; } public String getCustomLoadingImage() { return customLoadingImage; } public void setCustomLoadingImage(String customLoadingImage) { this.customLoadingImage = customLoadingImage; } public String getCustomBackground() { return customBackground; } public void setCustomBackground(String customBackground) { this.customBackground = customBackground; } public Boolean getShowChangeLanguageButton() { return showChangeLanguageButton; } public void setShowChangeLanguageButton(Boolean showChangeLanguageButton) { this.showChangeLanguageButton = showChangeLanguageButton; } public DefaultLanguage getDefaultLanguage() { return defaultLanguage; } public void setDefaultLanguage(DefaultLanguage defaultLanguage) { this.defaultLanguage = defaultLanguage; } public Boolean getShowForgetPasswordButton() { return showForgetPasswordButton; } public void setShowForgetPasswordButton(Boolean showForgetPasswordButton) { this.showForgetPasswordButton = showForgetPasswordButton; } public Boolean getShowEnterpriseConnections() { return showEnterpriseConnections; } public void setShowEnterpriseConnections(Boolean showEnterpriseConnections) { this.showEnterpriseConnections = showEnterpriseConnections; } public Boolean getShowSocialConnections() { return showSocialConnections; } public void setShowSocialConnections(Boolean showSocialConnections) { this.showSocialConnections = showSocialConnections; } /** * Guard 版本: * - `Advanced`: 高级版 * - `Classical`: 经典版 * */ public static enum GuardVersion { @JsonProperty("Advanced") ADVANCED("Advanced"), @JsonProperty("Classical") CLASSICAL("Classical"), ; private String value; GuardVersion(String value) { this.value = value; } public String getValue() { return value; } } /** * 展示的默认语言: * - `zh-CN`: 简体中文 * - `zh-TW`: 繁体中文 * - `en-US`: 英文 * - `ja-JP`: 日语 * * 默认情况下,Authing 登录页会根据用户浏览器语言自动渲染。 * */ public static enum DefaultLanguage { @JsonProperty("zh-CN") ZH_CN("zh-CN"), @JsonProperty("en-US") EN_US("en-US"), @JsonProperty("zh-TW") ZH_TW("zh-TW"), @JsonProperty("ja-JP") JA_JP("ja-JP"), ; private String value; DefaultLanguage(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationDefaultLoginMethod.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationDefaultLoginMethod { /** * 默认的登录类型 * - `PASSWORD`: 密码类型,取决于你开启的基础登录方式,支持手机号/邮箱/用户名 + 密码进行登录 * - `PASSCODE`: 验证码类型,取决于你开启的基础登录方式,支持手机号/邮箱 + 验证码进行登录 * - `QRCODE`: 扫码登录类型,目前包含自建 APP 扫码登录、关注微信公众号扫码登录、微信小程序扫码登录三种类型 * */ @JsonProperty("connectionType") private ConnectionType connectionType; /** * 当 `connectionType` 为 `QRCODE` 时,此参数表示二维码类型。 * - `SELF_BUILT_APP`: 自建 APP 扫码 * - `WECHAT_OFFICIAL_ACCOUNT`: 扫码关注微信公众号登录 * - `WECHAT_MINI_PROGRAM`: 微信小程序扫码登录 * */ @JsonProperty("qrcodeType") private QrcodeType qrcodeType; /** * 当 `connectionType` 为 `QRCODE` 时,你需要通过此参数指定具体的扫码登录身份源连接的 ID。 */ @JsonProperty("qrcodeExtIdpConnId") private String qrcodeExtIdpConnId; /** * 当 `connectionType` 为 `AD` 时,你需要通过此参数指定具体的 AD 身份源连接的 ID。 */ @JsonProperty("adExtIdpConnId") private String adExtIdpConnId; /** * 当 `connectionType` 为 `LDAP` 时,你需要通过此参数指定具体的 LDAP 身份源连接的 ID。 */ @JsonProperty("ldapExtIdpConnId") private String ldapExtIdpConnId; public ConnectionType getConnectionType() { return connectionType; } public void setConnectionType(ConnectionType connectionType) { this.connectionType = connectionType; } public QrcodeType getQrcodeType() { return qrcodeType; } public void setQrcodeType(QrcodeType qrcodeType) { this.qrcodeType = qrcodeType; } public String getQrcodeExtIdpConnId() { return qrcodeExtIdpConnId; } public void setQrcodeExtIdpConnId(String qrcodeExtIdpConnId) { this.qrcodeExtIdpConnId = qrcodeExtIdpConnId; } public String getAdExtIdpConnId() { return adExtIdpConnId; } public void setAdExtIdpConnId(String adExtIdpConnId) { this.adExtIdpConnId = adExtIdpConnId; } public String getLdapExtIdpConnId() { return ldapExtIdpConnId; } public void setLdapExtIdpConnId(String ldapExtIdpConnId) { this.ldapExtIdpConnId = ldapExtIdpConnId; } /** * 默认的登录类型 * - `PASSWORD`: 密码类型,取决于你开启的基础登录方式,支持手机号/邮箱/用户名 + 密码进行登录 * - `PASSCODE`: 验证码类型,取决于你开启的基础登录方式,支持手机号/邮箱 + 验证码进行登录 * - `QRCODE`: 扫码登录类型,目前包含自建 APP 扫码登录、关注微信公众号扫码登录、微信小程序扫码登录三种类型 * */ public static enum ConnectionType { @JsonProperty("PASSCODE") PASSCODE("PASSCODE"), @JsonProperty("PASSWORD") PASSWORD("PASSWORD"), @JsonProperty("QRCODE") QRCODE("QRCODE"), @JsonProperty("LDAP") LDAP("LDAP"), @JsonProperty("AD") AD("AD"), ; private String value; ConnectionType(String value) { this.value = value; } public String getValue() { return value; } } /** * 当 `connectionType` 为 `QRCODE` 时,此参数表示二维码类型。 * - `SELF_BUILT_APP`: 自建 APP 扫码 * - `WECHAT_OFFICIAL_ACCOUNT`: 扫码关注微信公众号登录 * - `WECHAT_MINI_PROGRAM`: 微信小程序扫码登录 * */ public static enum QrcodeType { @JsonProperty("SELF_BUILT_APP") SELF_BUILT_APP("SELF_BUILT_APP"), @JsonProperty("WECHAT_OFFICIAL_ACCOUNT") WECHAT_OFFICIAL_ACCOUNT("WECHAT_OFFICIAL_ACCOUNT"), @JsonProperty("WECHAT_MINI_PROGRAM") WECHAT_MINI_PROGRAM("WECHAT_MINI_PROGRAM"), ; private String value; QrcodeType(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationDefaultLoginMethodInput.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationDefaultLoginMethodInput { /** * 默认的登录类型 * - `PASSWORD`: 密码类型,取决于你开启的基础登录方式,支持手机号/邮箱/用户名 + 密码进行登录 * - `PASSCODE`: 验证码类型,取决于你开启的基础登录方式,支持手机号/邮箱 + 验证码进行登录 * - `QRCODE`: 扫码登录类型,目前包含自建 APP 扫码登录、关注微信公众号扫码登录、微信小程序扫码登录三种类型 * */ @JsonProperty("connectionType") private ConnectionType connectionType; /** * 当 `connectionType` 为 `QRCODE` 时,此参数表示二维码类型。 * - `SELF_BUILT_APP`: 自建 APP 扫码 * - `WECHAT_OFFICIAL_ACCOUNT`: 扫码关注微信公众号登录 * - `WECHAT_MINI_PROGRAM`: 微信小程序扫码登录 * */ @JsonProperty("qrcodeType") private QrcodeType qrcodeType; /** * 当 `connectionType` 为 `QRCODE` 时,你需要通过此参数指定具体的扫码登录身份源连接的 ID。 */ @JsonProperty("qrcodeExtIdpConnId") private String qrcodeExtIdpConnId; /** * 当 `connectionType` 为 `AD` 时,你需要通过此参数指定具体的 AD 身份源连接的 ID。 */ @JsonProperty("adExtIdpConnId") private String adExtIdpConnId; /** * 当 `connectionType` 为 `LDAP` 时,你需要通过此参数指定具体的 LDAP 身份源连接的 ID。 */ @JsonProperty("ldapExtIdpConnId") private String ldapExtIdpConnId; public ConnectionType getConnectionType() { return connectionType; } public void setConnectionType(ConnectionType connectionType) { this.connectionType = connectionType; } public QrcodeType getQrcodeType() { return qrcodeType; } public void setQrcodeType(QrcodeType qrcodeType) { this.qrcodeType = qrcodeType; } public String getQrcodeExtIdpConnId() { return qrcodeExtIdpConnId; } public void setQrcodeExtIdpConnId(String qrcodeExtIdpConnId) { this.qrcodeExtIdpConnId = qrcodeExtIdpConnId; } public String getAdExtIdpConnId() { return adExtIdpConnId; } public void setAdExtIdpConnId(String adExtIdpConnId) { this.adExtIdpConnId = adExtIdpConnId; } public String getLdapExtIdpConnId() { return ldapExtIdpConnId; } public void setLdapExtIdpConnId(String ldapExtIdpConnId) { this.ldapExtIdpConnId = ldapExtIdpConnId; } /** * 默认的登录类型 * - `PASSWORD`: 密码类型,取决于你开启的基础登录方式,支持手机号/邮箱/用户名 + 密码进行登录 * - `PASSCODE`: 验证码类型,取决于你开启的基础登录方式,支持手机号/邮箱 + 验证码进行登录 * - `QRCODE`: 扫码登录类型,目前包含自建 APP 扫码登录、关注微信公众号扫码登录、微信小程序扫码登录三种类型 * */ public static enum ConnectionType { @JsonProperty("PASSCODE") PASSCODE("PASSCODE"), @JsonProperty("PASSWORD") PASSWORD("PASSWORD"), @JsonProperty("QRCODE") QRCODE("QRCODE"), @JsonProperty("LDAP") LDAP("LDAP"), @JsonProperty("AD") AD("AD"), ; private String value; ConnectionType(String value) { this.value = value; } public String getValue() { return value; } } /** * 当 `connectionType` 为 `QRCODE` 时,此参数表示二维码类型。 * - `SELF_BUILT_APP`: 自建 APP 扫码 * - `WECHAT_OFFICIAL_ACCOUNT`: 扫码关注微信公众号登录 * - `WECHAT_MINI_PROGRAM`: 微信小程序扫码登录 * */ public static enum QrcodeType { @JsonProperty("SELF_BUILT_APP") SELF_BUILT_APP("SELF_BUILT_APP"), @JsonProperty("WECHAT_OFFICIAL_ACCOUNT") WECHAT_OFFICIAL_ACCOUNT("WECHAT_OFFICIAL_ACCOUNT"), @JsonProperty("WECHAT_MINI_PROGRAM") WECHAT_MINI_PROGRAM("WECHAT_MINI_PROGRAM"), ; private String value; QrcodeType(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationDto { /** * 应用 ID */ @JsonProperty("appId") private String appId; /** * 应用唯一标志 */ @JsonProperty("appIdentifier") private String appIdentifier; /** * 应用名称 */ @JsonProperty("appName") private String appName; /** * 应用 Logo 链接 */ @JsonProperty("appLogo") private String appLogo; /** * 应用描述信息 */ @JsonProperty("appDescription") private String appDescription; /** * 应用类型 */ @JsonProperty("appType") private AppType appType; /** * 用户池 ID */ @JsonProperty("userPoolId") private String userPoolId; /** * 是否为集成应用 */ @JsonProperty("isIntegrateApp") private Boolean isIntegrateApp; /** * 默认应用协议类型 */ @JsonProperty("defaultProtocol") private DefaultProtocol defaultProtocol; /** * 应用登录回调地址 */ @JsonProperty("redirectUris") private List<String> redirectUris; /** * 应用退出登录回调地址 */ @JsonProperty("logoutRedirectUris") private List<String> logoutRedirectUris; /** * 发起登录地址:在 Authing 应用详情点击「体验登录」或在应用面板点击该应用图标时,会跳转到此 URL,默认为 Authing 登录页。 */ @JsonProperty("initLoginUri") private String initLoginUri; /** * 是否开启 SSO 单点登录 */ @JsonProperty("ssoEnabled") private Boolean ssoEnabled; /** * 开启 SSO 单点登录的时间 */ @JsonProperty("ssoEnabledAt") private String ssoEnabledAt; /** * 登录配置 */ @JsonProperty("loginConfig") private ApplicationLoginConfigDto loginConfig; /** * 注册配置 */ @JsonProperty("registerConfig") private ApplicationRegisterConfig registerConfig; /** * 品牌化配置 */ @JsonProperty("brandingConfig") private ApplicationBrandingConfig brandingConfig; /** * OIDC 协议配置 */ @JsonProperty("oidcConfig") private OIDCConfig oidcConfig; /** * 是否开启 SAML 身份提供商 */ @JsonProperty("samlProviderEnabled") private Boolean samlProviderEnabled; /** * SAML 协议配置 */ @JsonProperty("samlConfig") private SamlIdpConfig samlConfig; /** * 是否开启 OAuth 身份提供商 */ @JsonProperty("oauthProviderEnabled") private Boolean oauthProviderEnabled; /** * OAuth2.0 协议配置 */ @JsonProperty("oauthConfig") private OauthIdpConfig oauthConfig; /** * 是否开启 CAS 身份提供商 */ @JsonProperty("casProviderEnabled") private Boolean casProviderEnabled; /** * CAS 协议配置 */ @JsonProperty("casConfig") private CasIdPConfig casConfig; /** * 是否自定义本应用的登录框,默认走全局的登录框配置。 */ @JsonProperty("customBrandingEnabled") private Boolean customBrandingEnabled; /** * 是否自定义本应用的安全规则,默认走全局的安全配置。 */ @JsonProperty("customSecurityEnabled") private Boolean customSecurityEnabled; /** * 集成应用的模版类型 */ @JsonProperty("template") private String template; public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } public String getAppIdentifier() { return appIdentifier; } public void setAppIdentifier(String appIdentifier) { this.appIdentifier = appIdentifier; } public String getAppName() { return appName; } public void setAppName(String appName) { this.appName = appName; } public String getAppLogo() { return appLogo; } public void setAppLogo(String appLogo) { this.appLogo = appLogo; } public String getAppDescription() { return appDescription; } public void setAppDescription(String appDescription) { this.appDescription = appDescription; } public AppType getAppType() { return appType; } public void setAppType(AppType appType) { this.appType = appType; } public String getUserPoolId() { return userPoolId; } public void setUserPoolId(String userPoolId) { this.userPoolId = userPoolId; } public Boolean getIsIntegrateApp() { return isIntegrateApp; } public void setIsIntegrateApp(Boolean isIntegrateApp) { this.isIntegrateApp = isIntegrateApp; } public DefaultProtocol getDefaultProtocol() { return defaultProtocol; } public void setDefaultProtocol(DefaultProtocol defaultProtocol) { this.defaultProtocol = defaultProtocol; } public List<String> getRedirectUris() { return redirectUris; } public void setRedirectUris(List<String> redirectUris) { this.redirectUris = redirectUris; } public List<String> getLogoutRedirectUris() { return logoutRedirectUris; } public void setLogoutRedirectUris(List<String> logoutRedirectUris) { this.logoutRedirectUris = logoutRedirectUris; } public String getInitLoginUri() { return initLoginUri; } public void setInitLoginUri(String initLoginUri) { this.initLoginUri = initLoginUri; } public Boolean getSsoEnabled() { return ssoEnabled; } public void setSsoEnabled(Boolean ssoEnabled) { this.ssoEnabled = ssoEnabled; } public String getSsoEnabledAt() { return ssoEnabledAt; } public void setSsoEnabledAt(String ssoEnabledAt) { this.ssoEnabledAt = ssoEnabledAt; } public ApplicationLoginConfigDto getLoginConfig() { return loginConfig; } public void setLoginConfig(ApplicationLoginConfigDto loginConfig) { this.loginConfig = loginConfig; } public ApplicationRegisterConfig getRegisterConfig() { return registerConfig; } public void setRegisterConfig(ApplicationRegisterConfig registerConfig) { this.registerConfig = registerConfig; } public ApplicationBrandingConfig getBrandingConfig() { return brandingConfig; } public void setBrandingConfig(ApplicationBrandingConfig brandingConfig) { this.brandingConfig = brandingConfig; } public OIDCConfig getOidcConfig() { return oidcConfig; } public void setOidcConfig(OIDCConfig oidcConfig) { this.oidcConfig = oidcConfig; } public Boolean getSamlProviderEnabled() { return samlProviderEnabled; } public void setSamlProviderEnabled(Boolean samlProviderEnabled) { this.samlProviderEnabled = samlProviderEnabled; } public SamlIdpConfig getSamlConfig() { return samlConfig; } public void setSamlConfig(SamlIdpConfig samlConfig) { this.samlConfig = samlConfig; } public Boolean getOauthProviderEnabled() { return oauthProviderEnabled; } public void setOauthProviderEnabled(Boolean oauthProviderEnabled) { this.oauthProviderEnabled = oauthProviderEnabled; } public OauthIdpConfig getOauthConfig() { return oauthConfig; } public void setOauthConfig(OauthIdpConfig oauthConfig) { this.oauthConfig = oauthConfig; } public Boolean getCasProviderEnabled() { return casProviderEnabled; } public void setCasProviderEnabled(Boolean casProviderEnabled) { this.casProviderEnabled = casProviderEnabled; } public CasIdPConfig getCasConfig() { return casConfig; } public void setCasConfig(CasIdPConfig casConfig) { this.casConfig = casConfig; } public Boolean getCustomBrandingEnabled() { return customBrandingEnabled; } public void setCustomBrandingEnabled(Boolean customBrandingEnabled) { this.customBrandingEnabled = customBrandingEnabled; } public Boolean getCustomSecurityEnabled() { return customSecurityEnabled; } public void setCustomSecurityEnabled(Boolean customSecurityEnabled) { this.customSecurityEnabled = customSecurityEnabled; } public String getTemplate() { return template; } public void setTemplate(String template) { this.template = template; } /** * 应用类型 */ public static enum AppType { @JsonProperty("web") WEB("web"), @JsonProperty("spa") SPA("spa"), @JsonProperty("native") NATIVE("native"), @JsonProperty("api") API("api"), @JsonProperty("mfa") MFA("mfa"), @JsonProperty("mini-program") MINI_PROGRAM("mini-program"), ; private String value; AppType(String value) { this.value = value; } public String getValue() { return value; } } /** * 默认应用协议类型 */ public static enum DefaultProtocol { @JsonProperty("oidc") OIDC("oidc"), @JsonProperty("oauth") OAUTH("oauth"), @JsonProperty("saml") SAML("saml"), @JsonProperty("cas") CAS("cas"), @JsonProperty("asa") ASA("asa"), ; private String value; DefaultProtocol(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationEnabledExtIdpConnDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationEnabledExtIdpConnDto { /** * 是否为社会化登录身份源连接 */ @JsonProperty("isSocial") private Boolean isSocial; /** * 身份源 ID */ @JsonProperty("extIdpId") private String extIdpId; /** * 身份源类型 */ @JsonProperty("extIdpType") private ExtIdpType extIdpType; /** * 身份源连接 ID */ @JsonProperty("extIdpConnId") private String extIdpConnId; /** * 身份源连接类型 */ @JsonProperty("extIdpConnType") private ExtIdpConnType extIdpConnType; /** * 身份源连接可读唯一标志 */ @JsonProperty("extIdpConnIdentifier") private String extIdpConnIdentifier; /** * 微信 */ @JsonProperty("extIdpConnDisplayName") private String extIdpConnDisplayName; /** * 身份源连接 Logo */ @JsonProperty("extIdpConnLogo") private String extIdpConnLogo; /** * 是否允许身份源连接 */ @JsonProperty("enabled") private Boolean enabled; public Boolean getIsSocial() { return isSocial; } public void setIsSocial(Boolean isSocial) { this.isSocial = isSocial; } public String getExtIdpId() { return extIdpId; } public void setExtIdpId(String extIdpId) { this.extIdpId = extIdpId; } public ExtIdpType getExtIdpType() { return extIdpType; } public void setExtIdpType(ExtIdpType extIdpType) { this.extIdpType = extIdpType; } public String getExtIdpConnId() { return extIdpConnId; } public void setExtIdpConnId(String extIdpConnId) { this.extIdpConnId = extIdpConnId; } public ExtIdpConnType getExtIdpConnType() { return extIdpConnType; } public void setExtIdpConnType(ExtIdpConnType extIdpConnType) { this.extIdpConnType = extIdpConnType; } public String getExtIdpConnIdentifier() { return extIdpConnIdentifier; } public void setExtIdpConnIdentifier(String extIdpConnIdentifier) { this.extIdpConnIdentifier = extIdpConnIdentifier; } public String getExtIdpConnDisplayName() { return extIdpConnDisplayName; } public void setExtIdpConnDisplayName(String extIdpConnDisplayName) { this.extIdpConnDisplayName = extIdpConnDisplayName; } public String getExtIdpConnLogo() { return extIdpConnLogo; } public void setExtIdpConnLogo(String extIdpConnLogo) { this.extIdpConnLogo = extIdpConnLogo; } public Boolean getEnabled() { return enabled; } public void setEnabled(Boolean enabled) { this.enabled = enabled; } /** * 身份源类型 */ public static enum ExtIdpType { @JsonProperty("oidc") OIDC("oidc"), @JsonProperty("oauth2") OAUTH2("oauth2"), @JsonProperty("saml") SAML("saml"), @JsonProperty("ldap") LDAP("ldap"), @JsonProperty("ad") AD("ad"), @JsonProperty("cas") CAS("cas"), @JsonProperty("azure-ad") AZURE_AD("azure-ad"), @JsonProperty("wechat") WECHAT("wechat"), @JsonProperty("google") GOOGLE("google"), @JsonProperty("qq") QQ("qq"), @JsonProperty("wechatwork") WECHATWORK("wechatwork"), @JsonProperty("dingtalk") DINGTALK("dingtalk"), @JsonProperty("weibo") WEIBO("weibo"), @JsonProperty("github") GITHUB("github"), @JsonProperty("alipay") ALIPAY("alipay"), @JsonProperty("apple") APPLE("apple"), @JsonProperty("baidu") BAIDU("baidu"), @JsonProperty("lark") LARK("lark"), @JsonProperty("gitlab") GITLAB("gitlab"), @JsonProperty("twitter") TWITTER("twitter"), @JsonProperty("facebook") FACEBOOK("facebook"), @JsonProperty("slack") SLACK("slack"), @JsonProperty("linkedin") LINKEDIN("linkedin"), @JsonProperty("yidun") YIDUN("yidun"), @JsonProperty("qingcloud") QINGCLOUD("qingcloud"), @JsonProperty("gitee") GITEE("gitee"), @JsonProperty("instagram") INSTAGRAM("instagram"), @JsonProperty("welink") WELINK("welink"), @JsonProperty("huawei") HUAWEI("huawei"), @JsonProperty("honor") HONOR("honor"), @JsonProperty("xiaomi") XIAOMI("xiaomi"), @JsonProperty("oppo") OPPO("oppo"), @JsonProperty("aws") AWS("aws"), @JsonProperty("amazon") AMAZON("amazon"), @JsonProperty("douyin") DOUYIN("douyin"), @JsonProperty("kuaishou") KUAISHOU("kuaishou"), @JsonProperty("line") LINE("line"), @JsonProperty("sdbz") SDBZ("sdbz"), ; private String value; ExtIdpType(String value) { this.value = value; } public String getValue() { return value; } } /** * 身份源连接类型 */ public static enum ExtIdpConnType { @JsonProperty("oidc") OIDC("oidc"), @JsonProperty("oauth") OAUTH("oauth"), @JsonProperty("saml") SAML("saml"), @JsonProperty("ldap") LDAP("ldap"), @JsonProperty("ad") AD("ad"), @JsonProperty("cas") CAS("cas"), @JsonProperty("azure-ad") AZURE_AD("azure-ad"), @JsonProperty("alipay") ALIPAY("alipay"), @JsonProperty("facebook") FACEBOOK("facebook"), @JsonProperty("facebook:mobile") FACEBOOK_MOBILE("facebook:mobile"), @JsonProperty("twitter") TWITTER("twitter"), @JsonProperty("google:mobile") GOOGLE_MOBILE("google:mobile"), @JsonProperty("google") GOOGLE("google"), @JsonProperty("wechat:pc") WECHAT_PC("wechat:pc"), @JsonProperty("wechat:mobile") WECHAT_MOBILE("wechat:mobile"), @JsonProperty("wechat:webpage-authorization") WECHAT_WEBPAGE_AUTHORIZATION("wechat:webpage-authorization"), @JsonProperty("wechatmp-qrcode") WECHATMP_QRCODE("wechatmp-qrcode"), @JsonProperty("wechat:miniprogram:default") WECHAT_MINIPROGRAM_DEFAULT("wechat:miniprogram:default"), @JsonProperty("wechat:miniprogram:qrconnect") WECHAT_MINIPROGRAM_QRCONNECT("wechat:miniprogram:qrconnect"), @JsonProperty("wechat:miniprogram:app-launch") WECHAT_MINIPROGRAM_APP_LAUNCH("wechat:miniprogram:app-launch"), @JsonProperty("github") GITHUB("github"), @JsonProperty("github:mobile") GITHUB_MOBILE("github:mobile"), @JsonProperty("qq") QQ("qq"), @JsonProperty("qq:mobile") QQ_MOBILE("qq:mobile"), @JsonProperty("wechatwork:corp:qrconnect") WECHATWORK_CORP_QRCONNECT("wechatwork:corp:qrconnect"), @JsonProperty("wechatwork:agency:qrconnect") WECHATWORK_AGENCY_QRCONNECT("wechatwork:agency:qrconnect"), @JsonProperty("wechatwork:service-provider:qrconnect") WECHATWORK_SERVICE_PROVIDER_QRCONNECT("wechatwork:service-provider:qrconnect"), @JsonProperty("wechatwork:mobile") WECHATWORK_MOBILE("wechatwork:mobile"), @JsonProperty("wechatwork:agency:mobile") WECHATWORK_AGENCY_MOBILE("wechatwork:agency:mobile"), @JsonProperty("dingtalk") DINGTALK("dingtalk"), @JsonProperty("dingtalk:mobile") DINGTALK_MOBILE("dingtalk:mobile"), @JsonProperty("dingtalk:provider") DINGTALK_PROVIDER("dingtalk:provider"), @JsonProperty("weibo") WEIBO("weibo"), @JsonProperty("weibo:mobile") WEIBO_MOBILE("weibo:mobile"), @JsonProperty("apple") APPLE("apple"), @JsonProperty("apple:web") APPLE_WEB("apple:web"), @JsonProperty("baidu") BAIDU("baidu"), @JsonProperty("baidu:mobile") BAIDU_MOBILE("baidu:mobile"), @JsonProperty("lark-internal") LARK_INTERNAL("lark-internal"), @JsonProperty("lark-public") LARK_PUBLIC("lark-public"), @JsonProperty("lark-block") LARK_BLOCK("lark-block"), @JsonProperty("gitlab") GITLAB("gitlab"), @JsonProperty("gitlab:mobile") GITLAB_MOBILE("gitlab:mobile"), @JsonProperty("linkedin") LINKEDIN("linkedin"), @JsonProperty("linkedin:mobile") LINKEDIN_MOBILE("linkedin:mobile"), @JsonProperty("slack") SLACK("slack"), @JsonProperty("slack:mobile") SLACK_MOBILE("slack:mobile"), @JsonProperty("yidun") YIDUN("yidun"), @JsonProperty("qingcloud") QINGCLOUD("qingcloud"), @JsonProperty("gitee") GITEE("gitee"), @JsonProperty("gitee:mobile") GITEE_MOBILE("gitee:mobile"), @JsonProperty("instagram") INSTAGRAM("instagram"), @JsonProperty("welink") WELINK("welink"), @JsonProperty("ad-kerberos") AD_KERBEROS("ad-kerberos"), @JsonProperty("huawei") HUAWEI("huawei"), @JsonProperty("huawei:mobile") HUAWEI_MOBILE("huawei:mobile"), @JsonProperty("honor") HONOR("honor"), @JsonProperty("xiaomi") XIAOMI("xiaomi"), @JsonProperty("xiaomi:mobile") XIAOMI_MOBILE("xiaomi:mobile"), @JsonProperty("aws") AWS("aws"), @JsonProperty("amazon") AMAZON("amazon"), @JsonProperty("amazon:mobile") AMAZON_MOBILE("amazon:mobile"), @JsonProperty("douyin:mobile") DOUYIN_MOBILE("douyin:mobile"), @JsonProperty("kuaishou:mobile") KUAISHOU_MOBILE("kuaishou:mobile"), @JsonProperty("line:mobile") LINE_MOBILE("line:mobile"), @JsonProperty("oppo:mobile") OPPO_MOBILE("oppo:mobile"), @JsonProperty("wechatwork:qrconnect:of:authing:agency") WECHATWORK_QRCONNECT_OF_AUTHING_AGENCY("wechatwork:qrconnect:of:authing:agency"), @JsonProperty("sdbz") SDBZ("sdbz"), ; private String value; ExtIdpConnType(String value) { this.value = value; } public String getValue() { return value; } } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationEnabledExtIdpConnInputDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationEnabledExtIdpConnInputDto { /** * 身份源连接 ID */ @JsonProperty("extIdpConnId") private String extIdpConnId; public String getExtIdpConnId() { return extIdpConnId; } public void setExtIdpConnId(String extIdpConnId) { this.extIdpConnId = extIdpConnId; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationLoginConfigDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationLoginConfigDto { /** * 是否开启登录注册合并 */ @JsonProperty("mergeLoginAndRegisterPage") private Boolean mergeLoginAndRegisterPage; /** * 开启的基础登录方式 */ @JsonProperty("enabledBasicLoginMethods") private List<String> enabledBasicLoginMethods; /** * 应用默认登录方式(不包含社会化登录和企业身份源登录) */ @JsonProperty("defaultLoginMethod") private ApplicationDefaultLoginMethod defaultLoginMethod; /** * 开启的外部身份源连接 */ @JsonProperty("enabledExtIdpConns") private List<ApplicationEnabledExtIdpConnDto> enabledExtIdpConns; /** * 是否展示用户授权页面 */ @JsonProperty("showAuthorizationPage") private Boolean showAuthorizationPage; public Boolean getMergeLoginAndRegisterPage() { return mergeLoginAndRegisterPage; } public void setMergeLoginAndRegisterPage(Boolean mergeLoginAndRegisterPage) { this.mergeLoginAndRegisterPage = mergeLoginAndRegisterPage; } public List<String> getEnabledBasicLoginMethods() { return enabledBasicLoginMethods; } public void setEnabledBasicLoginMethods(List<String> enabledBasicLoginMethods) { this.enabledBasicLoginMethods = enabledBasicLoginMethods; } public ApplicationDefaultLoginMethod getDefaultLoginMethod() { return defaultLoginMethod; } public void setDefaultLoginMethod(ApplicationDefaultLoginMethod defaultLoginMethod) { this.defaultLoginMethod = defaultLoginMethod; } public List<ApplicationEnabledExtIdpConnDto> getEnabledExtIdpConns() { return enabledExtIdpConns; } public void setEnabledExtIdpConns(List<ApplicationEnabledExtIdpConnDto> enabledExtIdpConns) { this.enabledExtIdpConns = enabledExtIdpConns; } public Boolean getShowAuthorizationPage() { return showAuthorizationPage; } public void setShowAuthorizationPage(Boolean showAuthorizationPage) { this.showAuthorizationPage = showAuthorizationPage; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationLoginConfigInputDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationLoginConfigInputDto { /** * 是否开启登录注册合并 */ @JsonProperty("mergeLoginAndRegisterPage") private Boolean mergeLoginAndRegisterPage; /** * 开启的基础登录方式 */ @JsonProperty("enabledBasicLoginMethods") private List<String> enabledBasicLoginMethods; /** * 应用默认登录方式(不包含社会化登录和企业身份源登录) */ @JsonProperty("defaultLoginMethod") private ApplicationDefaultLoginMethodInput defaultLoginMethod; /** * 开启的外部身份源连接 */ @JsonProperty("enabledExtIdpConnIds") private List<ApplicationEnabledExtIdpConnInputDto> enabledExtIdpConnIds; /** * 开启所有的外部身份源连接 */ @JsonProperty("enabledAllExtIdpConns") private Boolean enabledAllExtIdpConns; /** * 是否展示用户授权页面 */ @JsonProperty("showAuthorizationPage") private Boolean showAuthorizationPage; public Boolean getMergeLoginAndRegisterPage() { return mergeLoginAndRegisterPage; } public void setMergeLoginAndRegisterPage(Boolean mergeLoginAndRegisterPage) { this.mergeLoginAndRegisterPage = mergeLoginAndRegisterPage; } public List<String> getEnabledBasicLoginMethods() { return enabledBasicLoginMethods; } public void setEnabledBasicLoginMethods(List<String> enabledBasicLoginMethods) { this.enabledBasicLoginMethods = enabledBasicLoginMethods; } public ApplicationDefaultLoginMethodInput getDefaultLoginMethod() { return defaultLoginMethod; } public void setDefaultLoginMethod(ApplicationDefaultLoginMethodInput defaultLoginMethod) { this.defaultLoginMethod = defaultLoginMethod; } public List<ApplicationEnabledExtIdpConnInputDto> getEnabledExtIdpConnIds() { return enabledExtIdpConnIds; } public void setEnabledExtIdpConnIds(List<ApplicationEnabledExtIdpConnInputDto> enabledExtIdpConnIds) { this.enabledExtIdpConnIds = enabledExtIdpConnIds; } public Boolean getEnabledAllExtIdpConns() { return enabledAllExtIdpConns; } public void setEnabledAllExtIdpConns(Boolean enabledAllExtIdpConns) { this.enabledAllExtIdpConns = enabledAllExtIdpConns; } public Boolean getShowAuthorizationPage() { return showAuthorizationPage; } public void setShowAuthorizationPage(Boolean showAuthorizationPage) { this.showAuthorizationPage = showAuthorizationPage; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationMfaDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationMfaDto { /** * MFA 类型 */ @JsonProperty("mfaPolicy") private String mfaPolicy; /** * MFA 状态 */ @JsonProperty("status") private Integer status; /** * MFA 排序 */ @JsonProperty("sort") private Integer sort; public String getMfaPolicy() { return mfaPolicy; } public void setMfaPolicy(String mfaPolicy) { this.mfaPolicy = mfaPolicy; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Integer getSort() { return sort; } public void setSort(Integer sort) { this.sort = sort; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationPaginatedDataDto.java
package ai.genauth.sdk.java.dto; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationPaginatedDataDto { /** * 列表数据 */ @JsonProperty("list") private List<ApplicationDto> list; /** * 记录总数 */ @JsonProperty("totalCount") private Integer totalCount; public List<ApplicationDto> getList() { return list; } public void setList(List<ApplicationDto> list) { this.list = list; } public Integer getTotalCount() { return totalCount; } public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; } }
0
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java
java-sources/ai/genauth/genauth-java-sdk/3.1.11/ai/genauth/sdk/java/dto/ApplicationPaginatedRespDto.java
package ai.genauth.sdk.java.dto; import com.fasterxml.jackson.annotation.JsonProperty; public class ApplicationPaginatedRespDto { /** * 业务状态码,可以通过此状态码判断操作是否成功,200 表示成功。 */ @JsonProperty("statusCode") private Integer statusCode; /** * 描述信息 */ @JsonProperty("message") private String message; /** * 细分错误码,可通过此错误码得到具体的错误类型(成功请求不返回)。详细错误码列表请见:[API Code 列表](https://api-explorer.authing.cn/?tag=group/%E5%BC%80%E5%8F%91%E5%87%86%E5%A4%87#tag/%E5%BC%80%E5%8F%91%E5%87%86%E5%A4%87/%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/apiCode) */ @JsonProperty("apiCode") private Integer apiCode; /** * 请求 ID。当请求失败时会返回。 */ @JsonProperty("requestId") private String requestId; /** * 响应数据 */ @JsonProperty("data") private ApplicationPaginatedDataDto data; public Integer getStatusCode() { return statusCode; } public void setStatusCode(Integer statusCode) { this.statusCode = statusCode; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public Integer getApiCode() { return apiCode; } public void setApiCode(Integer apiCode) { this.apiCode = apiCode; } public String getRequestId() { return requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public ApplicationPaginatedDataDto getData() { return data; } public void setData(ApplicationPaginatedDataDto data) { this.data = data; } }