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
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

How to add to project

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

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

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