# Utility Methods

The CBSecurity model also has some methods that assist developers in their security needs

### Generating Passwords

You can use the `createPassword( length:32, letters:true, numbers:true, symbols:true )`&#x20;

```java
// Generate a random password 32 characters in length
cbsecure().createPassword()

// Generate with no symbols and 16 characters
cbsecure().createPassword( length: 16, symbols: false )

// Generate with no numbers and 12 characters
cbsecure().createPassword( length: 12, numbers: false )
```

### The Real Slim Shady!

You can also leverage our internal utility methods to get the current request's IP address and hostname.   Please remember that the default is to trust the upstream headers and check those first.

* `getRealIP( trustUpstream : true )` : Get a request's actual IP address
* `getRealHost( trustUpstream : true )` : Get a request's actual hostname used


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://coldbox-security.ortusbooks.com/usage/cbsecurity-model/utility-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
