Search in sources :

Example 1 with com.gw2auth.oauth2.server

use of com.gw2auth.oauth2.server in project cobigen by devonfw.

the class OpenAPIInputReader method extractServers.

/**
 * @param openApi document root
 * @return list of {@link ServerDef}'s
 */
private List<ServerDef> extractServers(OpenApi3 openApi) {
    List<ServerDef> servers = new LinkedList<>();
    ServerDef serv;
    for (Server server : openApi.getServers()) {
        serv = new ServerDef();
        serv.setDescription(server.getDescription());
        serv.setURI(server.getUrl());
        servers.add(serv);
    }
    return servers;
}
Also used : Server(com.reprezen.kaizen.oasparser.model3.Server) LinkedList(java.util.LinkedList) ServerDef(com.devonfw.cobigen.openapiplugin.model.ServerDef)

Example 2 with com.gw2auth.oauth2.server

use of com.gw2auth.oauth2.server in project ChatSystem by Dofmor.

the class ServerDriver method main.

public static void main(String[] args) {
    System.out.println("Enter an IP address: ");
    Scanner input = new Scanner(System.in);
    String ip = input.nextLine();
    ip = ip.trim();
    Server server = new Server(7777, "10.0.0.210");
    server.run();
}
Also used : Scanner(java.util.Scanner) Server(Server)

Example 3 with com.gw2auth.oauth2.server

use of com.gw2auth.oauth2.server in project oauth2-server by gw2auth.

the class ApiTokenControllerTest method updateApiToken.

@WithGw2AuthLogin
public void updateApiToken(MockHttpSession session) throws Exception {
    final long accountId = AuthenticationHelper.getUser(session).orElseThrow().getAccountId();
    final UUID gw2AccountId = UUID.randomUUID();
    final ApiTokenEntity apiToken = this.testHelper.createApiToken(accountId, gw2AccountId, Set.of(Gw2ApiPermission.ACCOUNT, Gw2ApiPermission.GUILDS), "TokenA");
    // verified
    this.testHelper.createAccountVerification(accountId, gw2AccountId);
    // register 2 clients
    final ClientRegistrationEntity clientRegistrationA = this.testHelper.createClientRegistration(accountId, "ClientA");
    final ClientRegistrationEntity clientRegistrationB = this.testHelper.createClientRegistration(accountId, "ClientB");
    // authorize 2 clients
    final ClientConsentEntity clientConsentA = this.testHelper.createClientConsent(accountId, clientRegistrationA.id(), Set.of(Gw2ApiPermission.ACCOUNT.oauth2()));
    final ClientConsentEntity clientConsentB = this.testHelper.createClientConsent(accountId, clientRegistrationB.id(), Set.of(Gw2ApiPermission.ACCOUNT.oauth2()));
    final String authorizationIdA = this.testHelper.createClientAuthorization(accountId, clientConsentA.clientRegistrationId(), clientConsentA.authorizedScopes()).id();
    final String authorizationIdB = this.testHelper.createClientAuthorization(accountId, clientConsentB.clientRegistrationId(), clientConsentB.authorizedScopes()).id();
    // use this token in both clients
    this.testHelper.createClientAuthorizationToken(accountId, authorizationIdA, gw2AccountId);
    this.testHelper.createClientAuthorizationToken(accountId, authorizationIdB, gw2AccountId);
    final String gw2ApiToken = TestHelper.randomRootToken();
    // prepare the gw2 rest server
    this.gw2RestServer.reset();
    prepareGw2RestServerForTokenInfoRequest(gw2ApiToken, "Token Name", Set.of(Gw2ApiPermission.ACCOUNT));
    preparedGw2RestServerForAccountRequest(gw2AccountId, gw2ApiToken, "Gw2AccountName.1234");
    final String responseJson = this.mockMvc.perform(patch("/api/token/{gw2AccountId}", gw2AccountId).session(session).with(csrf()).queryParam("gw2ApiToken", gw2ApiToken).queryParam("displayName", "New Display Name")).andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
    final ObjectMapper mapper = new ObjectMapper();
    final JsonNode apiTokenNode = mapper.readTree(responseJson);
    assertExpectedApiToken(new ExpectedApiToken(apiToken, true, List.of(clientRegistrationA, clientRegistrationB)), // display name should be updated
    "New Display Name", // api token should be updated
    gw2ApiToken, // the new api token has less permissions than the original one
    Set.of(Gw2ApiPermission.ACCOUNT.gw2()), apiTokenNode);
}
Also used : ApiTokenEntity(com.gw2auth.oauth2.server.repository.apitoken.ApiTokenEntity) ClientRegistrationEntity(com.gw2auth.oauth2.server.repository.client.registration.ClientRegistrationEntity) JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ClientConsentEntity(com.gw2auth.oauth2.server.repository.client.consent.ClientConsentEntity)

Example 4 with com.gw2auth.oauth2.server

use of com.gw2auth.oauth2.server in project ets-ogcapi-features10 by opengeospatial.

the class OpenApiUtils method findBasePath.

private static String findBasePath(OpenApi3 apiModel, URI iut) {
    String basePath = "/";
    List<Server> serverUrls = apiModel.getServers();
    for (Server serverUrl : serverUrls) {
        Matcher matcher = Pattern.compile(serverUrl.getUrl()).matcher(iut.toString());
        if (matcher.find()) {
            String path = iut.toString().substring(matcher.end(), iut.toString().length());
            if (!path.isEmpty()) {
                basePath = path;
            }
        }
    }
    return basePath;
}
Also used : Server(com.reprezen.kaizen.oasparser.model3.Server) Matcher(java.util.regex.Matcher)

Example 5 with com.gw2auth.oauth2.server

use of com.gw2auth.oauth2.server in project grpc-java by grpc.

the class ChannelzProtoUtil method toServer.

static Server toServer(InternalInstrumented<ServerStats> obj) {
    ServerStats stats = getFuture(obj.getStats());
    Server.Builder builder = Server.newBuilder().setRef(toServerRef(obj)).setData(toServerData(stats));
    for (InternalInstrumented<SocketStats> listenSocket : stats.listenSockets) {
        builder.addListenSocket(toSocketRef(listenSocket));
    }
    return builder.build();
}
Also used : Server(io.grpc.channelz.v1.Server) ServerStats(io.grpc.InternalChannelz.ServerStats) SocketStats(io.grpc.InternalChannelz.SocketStats)

Aggregations

Server (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server)15 ServerInstance (org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)10 Context (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context)9 Factory (org.eclipse.jst.server.tomcat.core.internal.xml.Factory)8 IPath (org.eclipse.core.runtime.IPath)6 FileInputStream (java.io.FileInputStream)5 IOException (java.io.IOException)5 IStatus (org.eclipse.core.runtime.IStatus)5 MultiStatus (org.eclipse.core.runtime.MultiStatus)5 Status (org.eclipse.core.runtime.Status)5 Host (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host)5 Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)4 Engine (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)4 Listener (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener)4 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)4 FileNotFoundException (java.io.FileNotFoundException)3 SAXException (org.xml.sax.SAXException)3 CustomOAuth2AuthorizationCodeRequestAuthenticationProvider (com.gw2auth.oauth2.server.adapt.CustomOAuth2AuthorizationCodeRequestAuthenticationProvider)2 JWKSet (com.nimbusds.jose.jwk.JWKSet)2 RSAKey (com.nimbusds.jose.jwk.RSAKey)2