Authentication overview

Actinia Grass GIS provides a RESTful API designed for integrating advanced geospatial processing into applications. Authentication is a critical component for controlling access to these powerful capabilities, ensuring that only authorized clients can initiate GRASS GIS and GDAL operations. The system employs standard web authentication practices to secure API endpoints and manage user sessions. All interactions with the Actinia API should occur over HTTPS to protect credentials and data in transit, aligning with web security best practices.

The Actinia architecture typically involves a server-side component managing GRASS GIS instances and exposing them via an API. Clients, whether web applications, desktop tools, or other services, authenticate with this API to submit processing jobs and retrieve results. This model supports automated workflows and complex analytical pipelines where geospatial tasks are executed programmatically without direct user intervention on the GRASS GIS command line.

Supported authentication methods

Actinia Grass GIS supports several authentication methods to accommodate different integration scenarios, from programmatic access to interactive user sessions. The choice of method typically depends on the client application's nature and the level of automation required.

The primary authentication methods include:

  • API Key Authentication: This method involves providing a unique, secret key with each API request. API keys are suitable for server-to-server communication and automated scripts where a user session is not required. They offer a straightforward way to grant access to specific services or users without exposing full user credentials.
  • Session-based Authentication: For interactive applications or user interfaces, Actinia may utilize session-based authentication. This typically involves a user logging in with a username and password, which then establishes a server-side session and issues a session token (e.g., a cookie). Subsequent requests include this token to maintain the authenticated state. This is common for web-based frontends interacting with the Actinia backend.

Authentication methods comparison

Method When to Use Security Level
API Key Automated scripts, server-to-server communication, backend services Moderate (requires careful key management)
Session-based (e.g., Cookie/Token) Interactive web applications, user interfaces, single-page applications High (relies on established session management protocols)

It is crucial to understand the implications of each method for security and operational efficiency. For instance, while API keys are simple to implement, their compromise can grant unauthorized access, necessitating robust key rotation and restricted permissions. Session-based authentication, conversely, typically involves more complex setup but can offer stronger security guarantees through features like session expiration and renewal, as detailed in OAuth 2.0 Bearer Token usage, which often underpins session tokens.

Getting your credentials

Acquiring the necessary authentication credentials for Actinia Grass GIS depends on the specific deployment and your role. For cloud-hosted or enterprise instances, credentials are typically provisioned by the service administrator. The Actinia API documentation provides guidance on how to manage these credentials once obtained, including API key generation and management through an administrative interface or specific API endpoints Actinia API documentation.

General steps for obtaining credentials usually involve:

  1. Contacting Your Administrator: For managed Actinia deployments, your system administrator or service provider will issue your API keys or set up your user account for session-based access.
  2. Self-Service Portal: Some Actinia installations may offer a web-based administrative panel where authorized users can generate, revoke, and manage their API keys. This portal might also be where you manage user roles and permissions.
  3. API-driven Credential Management: Advanced setups might allow for the programmatic creation and management of API keys via a dedicated API endpoint, requiring initial authentication with a master key or administrative credentials.

When an API key is generated, it is vital to store it securely. API keys act as a secret and should be treated with the same care as passwords. They should not be hardcoded directly into client-side code or publicly exposed. For session-based authentication, the platform will typically handle the secure issuance and management of session tokens after a successful login.

Authenticated request example

The method for including authentication credentials in your requests will vary based on the chosen authentication type.

API Key Authentication Example

When using API key authentication, the key is typically sent in an HTTP header, such as X-API-Key or Authorization with a custom scheme. Consult the specific Actinia deployment's documentation for the exact header name and format. Below is a conceptual example using curl, assuming the API key is sent in an X-API-Key header:

curl -X POST \
  'https://your-actinia-instance.com/api/v1/grass_modules/r.surf.idw' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "inputs": [
      {"param": "input", "value": "elevation@PERMANENT"},
      {"param": "output", "value": "interpolated_surface"}
    ],
    "flags": "z"
  }'

In this example, YOUR_API_KEY should be replaced with your actual API key. The request body contains the parameters for the GRASS GIS r.surf.idw module, typical for Actinia's processing endpoints.

Session-based Authentication Example (Conceptual)

For session-based authentication, the initial step would be a login request that returns a session token, often as a cookie. Subsequent requests would automatically include this cookie if using a standard web client or browser. For programmatic access, you would extract the session token and include it, for example, in an Authorization: Bearer <token> header (if using a JWT-style token) or as a cookie management in your HTTP client.

Step 1: Login Request (Conceptual)

curl -X POST \
  'https://your-actinia-instance.com/api/v1/auth/login' \
  -H 'Content-Type: application/json' \
  -d '{
    "username": "your_username",
    "password": "your_password"
  }'
# Response would typically include a session cookie or token

Step 2: Subsequent Authenticated Request (Conceptual, assuming cookie management)

curl -X GET \
  'https://your-actinia-instance.com/api/v1/resources/user_maps' \
  --cookie "JSESSIONID=YOUR_SESSION_ID" 
  # Or -H 'Authorization: Bearer YOUR_AUTH_TOKEN'

The exact implementation details for session management, including cookie names or token formats, are specific to the Actinia deployment. Developers should refer to their specific instance's authentication documentation for precise instructions.

Security best practices

Securing your Actinia Grass GIS integration is paramount to protect your geospatial data and processing resources. Adhering to established security practices helps mitigate common vulnerabilities and ensure the integrity of your operations.

  • Use HTTPS for All API Calls: Always ensure that all communication with the Actinia API occurs over HTTPS (TLS). This encrypts data in transit, preventing eavesdropping and tampering with API keys, session tokens, and geospatial data. This is a fundamental principle of secure network communication.
  • Securely Store API Keys: Never hardcode API keys directly into client-side code, commit them to public version control repositories, or expose them in client-side JavaScript. Store API keys in environment variables, dedicated secret management services (e.g., AWS Secrets Manager, Google Secret Manager), or secure configuration files on the server.
  • Implement Least Privilege: Grant API keys and user accounts only the minimum necessary permissions required for their intended function. For example, if a key is only needed to run a specific GRASS module, restrict its scope to that module if the Actinia deployment supports granular permissions.
  • Regularly Rotate API Keys: Periodically rotate API keys to minimize the impact of a compromised key. The frequency of rotation should align with your organization's security policies.
  • Monitor API Usage: Implement logging and monitoring for API access to detect unusual patterns or potential unauthorized activity. Alerts should be configured for excessive requests, failed authentication attempts, or access from unexpected IP addresses.
  • Validate and Sanitize Inputs: Although authentication controls access, validating and sanitizing all inputs to the Actinia API is crucial. This prevents injection attacks and ensures that only valid parameters are passed to GRASS GIS modules, safeguarding against unexpected behavior or resource exhaustion.
  • Manage Session Lifecycles: For session-based authentication, implement proper session management. This includes setting appropriate session expiration times, invalidating sessions upon logout, and renewing session tokens securely. Avoid indefinitely valid sessions.
  • Employ IP Whitelisting (where available): If your Actinia deployment supports it, restrict API key usage to a predefined list of trusted IP addresses. This adds an extra layer of security, as even if a key is compromised, it can only be used from authorized locations.