oauth2-java-client

OAuth2 Java Client

License

License

Categories

Categories

Java Languages H2 Data Databases Security OAuth2 CLI User Interface
GroupId

GroupId

com.clouway.security
ArtifactId

ArtifactId

oauth2-java-client-console
Last Version

Last Version

0.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

oauth2-java-client
OAuth2 Java Client
Project URL

Project URL

https://github.com/clouway/oauth2-java-client
Source Code Management

Source Code Management

https://github.com/clouway/oauth2-java-client

Download oauth2-java-client-console

How to add to project

<!-- https://jarcasting.com/artifacts/com.clouway.security/oauth2-java-client-console/ -->
<dependency>
    <groupId>com.clouway.security</groupId>
    <artifactId>oauth2-java-client-console</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.clouway.security/oauth2-java-client-console/
implementation 'com.clouway.security:oauth2-java-client-console:0.0.2'
// https://jarcasting.com/artifacts/com.clouway.security/oauth2-java-client-console/
implementation ("com.clouway.security:oauth2-java-client-console:0.0.2")
'com.clouway.security:oauth2-java-client-console:jar:0.0.2'
<dependency org="com.clouway.security" name="oauth2-java-client-console" rev="0.0.2">
  <artifact name="oauth2-java-client-console" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.clouway.security', module='oauth2-java-client-console', version='0.0.2')
)
libraryDependencies += "com.clouway.security" % "oauth2-java-client-console" % "0.0.2"
[com.clouway.security/oauth2-java-client-console "0.0.2"]

Dependencies

compile (8)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib jar 1.1.4-3
org.eclipse.jetty : jetty-webapp jar 9.3.14.v20161028
org.eclipse.jetty : jetty-server jar 9.3.14.v20161028
com.google.guava : guava jar 18.0
com.google.http-client : google-http-client-gson jar 1.22.0
com.google.http-client : google-http-client-appengine jar 1.22.0
com.google.http-client : google-http-client jar 1.23.0
com.google.oauth-client : google-oauth-client jar 1.23.0

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
org.jmock : jmock-junit4 jar 2.6.0
com.github.rest-driver : rest-client-driver jar 1.1.45

Project Modules

There are no modules declared in this project.

OAuth2 java client

A client library which uses oauth client secrets to send authorized requests or generate access tokens

OAuth2 client for console apps

Send authorized request, with access token generated by Google OAuth server, using google http client library
OАuthClientConfig config = OАuthClientConfig
       .setClient("::client::")
       .setSecret("::secret::")
       .setScopes(setOf("scope1", "scope2"))
       //you can pass other implementation of CredentialsStore, like - CredentialsDatabase
       .setCredentialsStorage(LocalCredentialsFileStorage(filePath))
       .build()
             
HttpRequestFactory factory = NetHttpTransport().createRequestFactory(
         BearerTokenInterceptor.newGoogleInterceptor(config))
 
 // do HTTP call

NOTE: your client should have redirect url : 'http://localhost:8089/oauth2callback'

NOTE: if this code is invoked by gradle task(groovy) you task should contain this line: 'standardInput = System.in' or Scanner object will throw exception.

Generate credentials using Google OAuth server for offline apps
OАuthClientConfig config = OАuthClientConfig
       .setClient("::client::")
       .setSecret("::secret::")
       .setScopes(setOf("scope1", "scope2"))
       .setCredentialsStorage(LocalCredentialsFileStorage(filePath))
       .build()
       
GoogleOAuthCredentialsFactory factory = new GoogleOAuthCredentialsFactory(config);
Credentials credentials = factory.getCredentials();

// do some action with credentials

License

Copyright 2017 clouWay ood.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

com.clouway.security

clouWay ood

Versions

Version
0.0.2
0.0.1