-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: CB SDK 3.x duration expiration max value can be 18 250 days * chore: merge samples Co-authored-by: Yuriy Movchan <Yuriy.Movchan@gmail.com>
- Loading branch information
Showing
5 changed files
with
106 additions
and
6 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...m/couchbase-sample/src/main/java/io/jans/orm/couchbase/CouchbaseAuthenticationSample.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. | ||
* | ||
* Copyright (c) 2020, Janssen Project | ||
*/ | ||
|
||
package io.jans.orm.couchbase; | ||
|
||
import java.util.List; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import io.jans.orm.couchbase.impl.CouchbaseEntryManager; | ||
import io.jans.orm.couchbase.operation.impl.CouchbaseConnectionProvider; | ||
import io.jans.orm.model.base.SimpleUser; | ||
import io.jans.orm.search.filter.Filter; | ||
|
||
/** | ||
* @author Yuriy Movchan Date: 11/03/2016 | ||
*/ | ||
public final class CouchbaseAuthenticationSample { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(CouchbaseConnectionProvider.class); | ||
|
||
private CouchbaseAuthenticationSample() { | ||
} | ||
|
||
public static void main(String[] args) { | ||
// Prepare sample connection details | ||
CouchbaseEntryManagerSample couchbaseEntryManagerSample = new CouchbaseEntryManagerSample(); | ||
|
||
// Create Couchbase entry manager | ||
CouchbaseEntryManager couchbaseEntryManager = couchbaseEntryManagerSample.createCouchbaseEntryManager(); | ||
|
||
List<SimpleUser> users = couchbaseEntryManager.findEntries("ou=people,o=gluu", SimpleUser.class, null); | ||
for (SimpleUser user : users) { | ||
LOG.info("User with uid: '{}' with DN: '{}'", user.getUserId(), user.getDn()); | ||
} | ||
|
||
boolean authenticated = couchbaseEntryManager.authenticate("ou=people,o=gluu", SimpleUser.class, "test_user", "test_user_password"); | ||
LOG.info("User with uid: '{}' with DN: '{}'", "test_user", authenticated); | ||
|
||
Filter userUidFilter = Filter.createEqualityFilter(Filter.createLowercaseFilter("uid"), "test_user"); | ||
List<SimpleUser> foundUsers = couchbaseEntryManager.findEntries("ou=people,o=gluu", SimpleUser.class, userUidFilter); | ||
if (foundUsers.size() > 0) { | ||
SimpleUser user = foundUsers.get(0); | ||
LOG.info("Found uid: '{}' with custom attributes: '{}'", user.getUserId(), user.getCustomAttributes()); | ||
} | ||
} | ||
|
||
} |
This file contains 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
42 changes: 42 additions & 0 deletions
42
jans-orm/sql-sample/src/main/java/io/jans/orm/sql/SqlCheckGroupSample.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. | ||
* | ||
* Copyright (c) 2020, Janssen Project | ||
*/ | ||
|
||
package io.jans.orm.sql; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import io.jans.orm.search.filter.Filter; | ||
import io.jans.orm.sql.impl.SqlEntryManager; | ||
import io.jans.orm.sql.model.SimpleGroup; | ||
import io.jans.orm.sql.operation.impl.SqlConnectionProvider; | ||
import io.jans.orm.sql.persistence.SqlEntryManagerSample; | ||
|
||
/** | ||
* @author Yuriy Movchan Date: 01/15/2020 | ||
*/ | ||
public final class SqlCheckGroupSample { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(SqlConnectionProvider.class); | ||
|
||
private SqlCheckGroupSample() { | ||
} | ||
|
||
public static void main(String[] args) { | ||
// Prepare sample connection details | ||
SqlEntryManagerSample sqlEntryManagerSample = new SqlEntryManagerSample(); | ||
|
||
// Create SQL entry manager | ||
SqlEntryManager sqlEntryManager = sqlEntryManagerSample.createSqlEntryManager(); | ||
|
||
// EQ -- String | ||
Filter searchFilter = Filter.create("(&(dn=inum=60B7,ou=groups,o=gluu)(|(owner=inum=78c0ea07-d9db-4ccd-9039-4911a6426a0c,ou=people,o=gluu)(member=inum=78c0ea07-d9db-4ccd-9039-4911a6426a0c,ou=people,o=gluu)))"); | ||
|
||
boolean isMemberOrOwner = sqlEntryManager.findEntries("inum=60B7,ou=groups,o=gluu", SimpleGroup.class, searchFilter, 1).size() > 0; | ||
System.out.println(isMemberOrOwner); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
jans-orm/sql/src/main/java/io/jans/orm/sql/model/JsonString.java
This file contains 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
6 changes: 6 additions & 0 deletions
6
jans-orm/sql/src/main/java/io/jans/orm/sql/operation/SupportedDbType.java
This file contains 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