To create new projects:
mix new kv
mix new kv --module KV
To load iex with mix project files:
#!/bin/bash | |
URL="https://prep2024.ine.mx/publicacion/nacional/assets/presidencia/presidenciaNacional.json" | |
fetch_and_print() { | |
echo "------------------------------------------------------------------------------------" | |
JSON_FILE="presidenciaNacional_$(date +%Y-%m-%d_%H-%M-%S).json" | |
curl --compressed -o "$JSON_FILE" "$URL" | |
if [ $? -ne 0 ]; then |
+-----------------+--------+-----------+ | |
| Column | Type | Modifiers | | |
|-----------------+--------+-----------| | |
| employee_id | bigint | not null | | |
| corporate_email | text | not null | | |
| first_name | text | not null | | |
| last_name | text | not null | | |
+-----------------+--------+-----------+ | |
Indexes: | |
"employee_pkey" PRIMARY KEY, btree (employee_id) |
micronaut: | |
application: | |
name: <your-application-name> | |
security: | |
authentication: cookie | |
token: | |
jwt: | |
signatures: | |
secret: | |
generator: |
package com.jabaddon.tutorials.micronaut.loginwithmicrosoft; | |
import edu.umd.cs.findbugs.annotations.Nullable; | |
import io.micronaut.core.async.publisher.Publishers; | |
import io.micronaut.security.authentication.AuthenticationResponse; | |
import io.micronaut.security.authentication.UserDetails; | |
import io.micronaut.security.oauth2.endpoint.authorization.state.State; | |
import io.micronaut.security.oauth2.endpoint.token.response.OauthUserDetailsMapper; | |
import io.micronaut.security.oauth2.endpoint.token.response.TokenResponse; | |
import io.reactivex.Single; |
package com.jabaddon.tutorials.micronaut.loginwithmicrosoft; | |
import io.micronaut.core.type.Argument; | |
import io.micronaut.http.HttpRequest; | |
import io.micronaut.http.MutableHttpRequest; | |
import io.micronaut.http.client.RxHttpClient; | |
import io.micronaut.http.uri.UriBuilder; | |
import io.reactivex.Flowable; | |
import io.reactivex.Single; |
package com.jabaddon.tutorials.micronaut.loginwithmicrosoft; | |
import io.micronaut.core.annotation.Introspected; | |
@Introspected | |
public class MicrosoftUser { | |
private String id; | |
private String surname; | |
private String givenName; | |
private String userPrincipalName; |
<!DOCTYPE html> | |
<html xmlns:th="http://www.thymeleaf.org"> | |
<head> | |
<title>Home Page</title> | |
</head> | |
<body> | |
<h1>Micronaut Tutorial - Login with Microsoft</h1> | |
<h2 th:if="${security}">Welcome authenticated user: <span th:text="${security.attributes.user['userPrincipalName']}"></h2> |
package com.jabaddon.tutorials.micronaut.loginwithmicrosoft; | |
import io.micronaut.http.annotation.Controller; | |
import io.micronaut.http.annotation.Get; | |
import io.micronaut.security.annotation.Secured; | |
import io.micronaut.security.rules.SecurityRule; | |
import io.micronaut.views.View; | |
import java.util.HashMap; | |
import java.util.Map; |
To create new projects:
mix new kv
mix new kv --module KV
To load iex with mix project files:
use Mix.Config | |
# ... | |
config :ecto_101_migrations_schemas, Ecto101MigrationsSchemas.Repo, | |
adapter: Ecto.Adapters.Postgres, | |
database: "ecto_test", | |
username: "postgres", | |
password: "", | |
hostname: "localhost" | |
config :ecto_101_migrations_schemas, ecto_repos: [Ecto101MigrationsSchemas.Repo] |