This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
micronaut: | |
application: | |
name: <your-application-name> | |
security: | |
authentication: cookie | |
token: | |
jwt: | |
signatures: | |
secret: | |
generator: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+-----------------+--------+-----------+ | |
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
OlderNewer