All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.adorsys.ledgers.keycloak.client.rest.KeycloakTokenRestClient Maven / Gradle / Ivy

There is a newer version: 4.17
Show newest version
package de.adorsys.ledgers.keycloak.client.rest;

import de.adorsys.ledgers.keycloak.client.model.TokenConfiguration;
import feign.Headers;
import org.keycloak.representations.AccessToken;
import org.keycloak.representations.AccessTokenResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "keycloakTokenRestClient",
        url = "${keycloak.auth-server-url}")
@Headers({"Content-Type: application/x-www-form-urlencoded"})
public interface KeycloakTokenRestClient {

    @SuppressWarnings("java:S1452")
    @PostMapping(value = "/realms/${keycloak.realm}/protocol/openid-connect/token", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    ResponseEntity> login(MultiValueMap formParams);

    @PostMapping(value = "/realms/${keycloak.realm}/configurable-token")
    ResponseEntity exchangeToken(@RequestHeader("Authorization") String token,
                                                      @RequestBody TokenConfiguration tokenConfiguration);

    @PostMapping(value = "/realms/${keycloak.realm}/protocol/openid-connect/token/introspect", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    ResponseEntity validate(MultiValueMap formParams);

    @PutMapping(value = "/admin/realms/${keycloak.realm}/users/{user-id}/execute-actions-email")
    ResponseEntity executeActionsEmail(@RequestHeader("Authorization") String bearerToken,
                                                            @PathVariable("user-id") String userId,
                                                            @RequestBody List requiredActions);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy